From patchwork Mon Jun 15 11:51:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alvise Rigo X-Patchwork-Id: 484228 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id EA538140273 for ; Mon, 15 Jun 2015 21:52:04 +1000 (AEST) Received: from localhost ([::1]:33570 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4Svr-0007wM-64 for incoming@patchwork.ozlabs.org; Mon, 15 Jun 2015 07:52:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4Stk-0004X9-MH for qemu-devel@nongnu.org; Mon, 15 Jun 2015 07:49:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z4Stf-0003y8-Fs for qemu-devel@nongnu.org; Mon, 15 Jun 2015 07:49:52 -0400 Received: from mail-wg0-f46.google.com ([74.125.82.46]:33498) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4Stf-0003y0-AL for qemu-devel@nongnu.org; Mon, 15 Jun 2015 07:49:47 -0400 Received: by wgez8 with SMTP id z8so66699049wge.0 for ; Mon, 15 Jun 2015 04:49:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FxMmtht5JIt+lxBWn1tT+VxYJzFYEecuyUGxmhYNQNc=; b=XacRpvw0Scld2JvZ1BUIiynDFSQo1mkTOtW3Pt6zrP4jLOFJDWqllYXLZ6OqOK4Ycz sGRPOo8f27MupflB1yqyYGQYNSZ7Olk1gyZUZRid3wsI37cUdodCEzxy3L62f8IV3ZPC Zeksgip5dFytT0L/2W24GGqA0Ed/NHsFeaco1fMmZ3jpWZ+oB/V351n+F5InVJCEX6cv iGI8xouCd52c/9sszSB4qIiBnCGTaezdkLExLw4tF0Sd+Dp4q5LHcBtJ/z5NVQPcyDji NZkPICTVMWiy1xR3qT/GRQdi+gWyW1hR6URTr9RdVaXbVGutaBhu0goHPc8ScptrzAca jUmQ== X-Gm-Message-State: ALoCoQmyAtKmL+vrZGBOW2f0uInXLzbyDd88TVbaiGY0Zt80DVwXpz44Z5Fjcpmc3GDIjOlXR4u1 X-Received: by 10.180.94.168 with SMTP id dd8mr30234656wib.76.1434368986748; Mon, 15 Jun 2015 04:49:46 -0700 (PDT) Received: from linarch.home (LPuteaux-656-1-278-113.w80-15.abo.wanadoo.fr. [80.15.154.113]) by mx.google.com with ESMTPSA id tl3sm18570524wjc.20.2015.06.15.04.49.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Jun 2015 04:49:45 -0700 (PDT) From: Alvise Rigo To: qemu-devel@nongnu.org Date: Mon, 15 Jun 2015 13:51:22 +0200 Message-Id: <1434369088-15076-2-git-send-email-a.rigo@virtualopensystems.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1434369088-15076-1-git-send-email-a.rigo@virtualopensystems.com> References: <1434369088-15076-1-git-send-email-a.rigo@virtualopensystems.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.82.46 Cc: mttcg@listserver.greensocs.com, claudio.fontana@huawei.com, cota@braap.org, jani.kokkonen@huawei.com, tech@virtualopensystems.com, alex.bennee@linaro.org, rth@twiddle.net Subject: [Qemu-devel] [RFC v2 1/7] bitmap: Add bitmap_one_extend operation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Suggested-by: Jani Kokkonen Suggested-by: Claudio Fontana Signed-off-by: Alvise Rigo --- include/qemu/bitmap.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/qemu/bitmap.h b/include/qemu/bitmap.h index 86dd9cd..c59e8e7 100644 --- a/include/qemu/bitmap.h +++ b/include/qemu/bitmap.h @@ -246,4 +246,13 @@ static inline unsigned long *bitmap_zero_extend(unsigned long *old, return new; } +static inline unsigned long *bitmap_one_extend(unsigned long *old, + long old_nbits, long new_nbits) +{ + long new_len = BITS_TO_LONGS(new_nbits) * sizeof(unsigned long); + unsigned long *new = g_realloc(old, new_len); + bitmap_set(new, old_nbits, new_nbits - old_nbits); + return new; +} + #endif /* BITMAP_H */