diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-06-04 00:07:20 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-06-11 00:25:06 +0100 |
commit | 591b320ad046b2780c1b2841b836b50ba8192f02 (patch) | |
tree | 2ba9ddd9749006fec105964c7bd43d9f34e971b2 /util | |
parent | 6b24119b7f5b250119b67d93ea6d044500483e82 (diff) | |
download | qemu-591b320ad046b2780c1b2841b836b50ba8192f02.zip qemu-591b320ad046b2780c1b2841b836b50ba8192f02.tar.gz qemu-591b320ad046b2780c1b2841b836b50ba8192f02.tar.bz2 |
util/hbitmap.c: Use ctpopl rather than reimplementing a local equivalent
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).
Reported-by: Martin Husemann <martin@duskware.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/hbitmap.c | 9 |
1 files 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; |