From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: Martin Husemann <martin@duskware.de>, patches@linaro.org
Subject: [Qemu-devel] [PATCH] util/hbitmap.c: Use ctpopl rather than reimplementing a local equivalent
Date: Wed, 4 Jun 2014 00:41:32 +0100 [thread overview]
Message-ID: <1401838892-2073-1-git-send-email-peter.maydell@linaro.org> (raw)
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 <peter.maydell@linaro.org>
Reported-by: Martin Husemann <martin@duskware.de>
---
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;
--
1.9.2
next reply other threads:[~2014-06-03 23:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-03 23:41 Peter Maydell [this message]
2014-06-04 7:13 ` [Qemu-devel] [PATCH] util/hbitmap.c: Use ctpopl rather than reimplementing a local equivalent Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1401838892-2073-1-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=martin@duskware.de \
--cc=patches@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).