From nobody Tue Feb 10 06:27:15 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1566286060; cv=none; d=zoho.com; s=zohoarc; b=Yox1V7kHbmckHrnLLRzyDHaeYZQ8iNJ1PW0RwYPorGjuVNnuM66kjrHFkLI47mvev1eqyH/6XIwPBFFdfnAUA312REQ+NRJAS4weAg/dvSVqR1Ocz6MMd4HHdlVWe5mnpnnHzkcDII7tvJ68bXFkzev4VVZDtzLpY439qc2VCb8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566286060; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=YLBfdxhILh+k5yvX102QeIiw34480WolBmJtfJAaok0=; b=BjPoLA9zlInZNgjO2pRxkmiRaahiHNVWgz4bzR3i8YQ0eMl56mBZ0F8flcLt6dTm+Gs5jm+5rgKBGM8O1+lhQpMx/EyivWXo9psm0EBeP1YZjM94nbPXIDNUAH91MuGVqm+bYPmVG0tmpUWnXnZHA+FjtBOK7p7WZcdr7SLSbYk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566286060415621.9790626117834; Tue, 20 Aug 2019 00:27:40 -0700 (PDT) Received: from localhost ([::1]:34098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzyYM-0005s5-AJ for importer@patchew.org; Tue, 20 Aug 2019 03:27:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42882) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzy8z-0005z4-0c for qemu-devel@nongnu.org; Tue, 20 Aug 2019 03:01:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hzy8x-0003pa-ND for qemu-devel@nongnu.org; Tue, 20 Aug 2019 03:01:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47986) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hzy8u-0003hM-VF for qemu-devel@nongnu.org; Tue, 20 Aug 2019 03:01:21 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A68FA3CA0B; Tue, 20 Aug 2019 07:01:15 +0000 (UTC) Received: from 640k.localdomain.com (ovpn-112-20.ams2.redhat.com [10.36.112.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E98A60BE2; Tue, 20 Aug 2019 07:01:14 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 20 Aug 2019 08:59:53 +0200 Message-Id: <1566284395-30287-35-git-send-email-pbonzini@redhat.com> In-Reply-To: <1566284395-30287-1-git-send-email-pbonzini@redhat.com> References: <1566284395-30287-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 20 Aug 2019 07:01:15 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 34/36] test-bitmap: test set 1 bit case for bitmap_set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wei Yang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Wei Yang All current bitmap_set test cases set range across word, while the handle of a range within one word is different from that. Add case to set 1 bit as a represent for set range within one word. Signed-off-by: Wei Yang Signed-off-by: Paolo Bonzini --- tests/test-bitmap.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test-bitmap.c b/tests/test-bitmap.c index 18aa584..087e02a 100644 --- a/tests/test-bitmap.c +++ b/tests/test-bitmap.c @@ -67,6 +67,18 @@ static void bitmap_set_case(bmap_set_func set_func) =20 bmap =3D bitmap_new(BMAP_SIZE); =20 + /* Set one bit at offset in second word */ + for (offset =3D 0; offset <=3D BITS_PER_LONG; offset++) { + bitmap_clear(bmap, 0, BMAP_SIZE); + set_func(bmap, BITS_PER_LONG + offset, 1); + g_assert_cmpint(find_first_bit(bmap, 2 * BITS_PER_LONG), + =3D=3D, BITS_PER_LONG + offset); + g_assert_cmpint(find_next_zero_bit(bmap, + 3 * BITS_PER_LONG, + BITS_PER_LONG + offset), + =3D=3D, BITS_PER_LONG + offset + 1); + } + /* Both Aligned, set bits [BITS_PER_LONG, 3*BITS_PER_LONG] */ set_func(bmap, BITS_PER_LONG, 2 * BITS_PER_LONG); g_assert_cmpuint(bmap[1], =3D=3D, -1ul); --=20 1.8.3.1