From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ws5OM-0003y1-Es for qemu-devel@nongnu.org; Wed, 04 Jun 2014 03:13:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ws5OH-0007E7-OI for qemu-devel@nongnu.org; Wed, 04 Jun 2014 03:13:46 -0400 Received: from mail-qa0-x22b.google.com ([2607:f8b0:400d:c00::22b]:50501) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ws5OH-0007E2-JL for qemu-devel@nongnu.org; Wed, 04 Jun 2014 03:13:41 -0400 Received: by mail-qa0-f43.google.com with SMTP id m5so6626697qaj.30 for ; Wed, 04 Jun 2014 00:13:41 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <538EC722.6050603@redhat.com> Date: Wed, 04 Jun 2014 09:13:38 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1401838892-2073-1-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1401838892-2073-1-git-send-email-peter.maydell@linaro.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] util/hbitmap.c: Use ctpopl rather than reimplementing a local equivalent List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-devel@nongnu.org Cc: Martin Husemann , patches@linaro.org Il 04/06/2014 01:41, Peter Maydell ha scritto: > The function popcountl() in hbitmap.c is effectively a reimplementation > of what host-utils.h provides as ctpopl(). Use ctpopl() directly; this fixes > a failure to compile on NetBSD (whose strings.h erroneously exposes a > system popcountl() which clashes with this one). > > Signed-off-by: Peter Maydell > Reported-by: Martin Husemann > --- > We haven't compiled on NetBSD for over a year... > > util/hbitmap.c | 9 ++------- > 1 file changed, 2 insertions(+), 7 deletions(-) > > diff --git a/util/hbitmap.c b/util/hbitmap.c > index d936831..b3060e6 100644 > --- a/util/hbitmap.c > +++ b/util/hbitmap.c > @@ -92,11 +92,6 @@ struct HBitmap { > unsigned long *levels[HBITMAP_LEVELS]; > }; > > -static inline int popcountl(unsigned long l) > -{ > - return BITS_PER_LONG == 32 ? ctpop32(l) : ctpop64(l); > -} > - > /* Advance hbi to the next nonzero word and return it. hbi->pos > * is updated. Returns zero if we reach the end of the bitmap. > */ > @@ -200,14 +195,14 @@ static uint64_t hb_count_between(HBitmap *hb, uint64_t start, uint64_t last) > if (pos >= (end >> BITS_PER_LEVEL)) { > break; > } > - count += popcountl(cur); > + count += ctpopl(cur); > } > > if (pos == (end >> BITS_PER_LEVEL)) { > /* Drop bits representing the END-th and subsequent items. */ > int bit = end & (BITS_PER_LONG - 1); > cur &= (1UL << bit) - 1; > - count += popcountl(cur); > + count += ctpopl(cur); > } > > return count; > Reviewed-by: Paolo Bonzini