[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 02/15] util/hbitmap.c: Use ctpopl rather than reimple
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 02/15] util/hbitmap.c: Use ctpopl rather than reimplementing a local equivalent |
Date: |
Wed, 11 Jun 2014 15:29:40 +0100 |
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 <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Peter Maydell <address@hidden>
---
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
- [Qemu-devel] [PULL 00/15] bsd-user queue, Peter Maydell, 2014/06/11
- [Qemu-devel] [PULL 14/15] bsd-user: Implement strace support for thr_* syscalls, Peter Maydell, 2014/06/11
- [Qemu-devel] [PULL 15/15] bsd-user: Fix syscall format, add strace support for more syscalls, Peter Maydell, 2014/06/11
- [Qemu-devel] [PULL 13/15] bsd-user: Implement strace support for extattr_* syscalls, Peter Maydell, 2014/06/11
- [Qemu-devel] [PULL 11/15] bsd-user: Implement strace support for print_ioctl syscall, Peter Maydell, 2014/06/11
- [Qemu-devel] [PULL 10/15] bsd-user: Implement strace support for print_sysctl syscall, Peter Maydell, 2014/06/11
- [Qemu-devel] [PULL 07/15] exec: replace ffsl with ctzl, Peter Maydell, 2014/06/11
- [Qemu-devel] [PULL 02/15] util/hbitmap.c: Use ctpopl rather than reimplementing a local equivalent,
Peter Maydell <=
- [Qemu-devel] [PULL 09/15] bsd-user: GPL v2 attribution update and style, Peter Maydell, 2014/06/11
- [Qemu-devel] [PULL 08/15] bsd-user: add HOST_VARIANT_DIR for various *BSD dependent code, Peter Maydell, 2014/06/11
- [Qemu-devel] [PULL 06/15] vhost: replace ffsl with ctzl, Peter Maydell, 2014/06/11
- [Qemu-devel] [PULL 03/15] bsd-user/mmap.c: Don't try to override g_malloc/g_free, Peter Maydell, 2014/06/11
- [Qemu-devel] [PULL 01/15] bsd-user: refresh freebsd system call numbers, Peter Maydell, 2014/06/11
- [Qemu-devel] [PULL 04/15] util/qemu-openpty: fix build with musl libc by include termios.h as fallback, Peter Maydell, 2014/06/11
- [Qemu-devel] [PULL 12/15] bsd-user: Implement strace support for __acl_* syscalls, Peter Maydell, 2014/06/11
- [Qemu-devel] [PULL 05/15] xen: replace ffsl with ctzl, Peter Maydell, 2014/06/11
- Re: [Qemu-devel] [PULL 00/15] bsd-user queue, Peter Maydell, 2014/06/11