diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-02-01 23:03:16 +0100 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2013-02-02 20:16:00 +0000 |
commit | fbeadf50f2f965741def823036b086bbc2999b1f (patch) | |
tree | 859da9be446ae21d999274d1972730a69e1de9ee /include/qemu/hbitmap.h | |
parent | 7b2d9779818f4c0d4c31d3a0292bee1c4b633217 (diff) | |
download | hqemu-fbeadf50f2f965741def823036b086bbc2999b1f.zip hqemu-fbeadf50f2f965741def823036b086bbc2999b1f.tar.gz |
bitops: unify bitops_ffsl with the one in host-utils.h, call it bitops_ctzl
We had two copies of a ffs function for longs with subtly different
semantics and, for the one in bitops.h, a confusing name: the result
was off-by-one compared to the library function ffsl.
Unify the functions into one, and solve the name problem by calling
the 0-based functions "bitops_ctzl" and "bitops_ctol" respectively.
This also fixes the build on platforms with ffsl, including Mac OS X
and Windows.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Andreas Färber <afaerber@suse.de>
Tested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'include/qemu/hbitmap.h')
-rw-r--r-- | include/qemu/hbitmap.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/qemu/hbitmap.h b/include/qemu/hbitmap.h index 73f5d1d..250de03 100644 --- a/include/qemu/hbitmap.h +++ b/include/qemu/hbitmap.h @@ -170,7 +170,7 @@ static inline int64_t hbitmap_iter_next(HBitmapIter *hbi) /* The next call will resume work from the next bit. */ hbi->cur[HBITMAP_LEVELS - 1] = cur & (cur - 1); - item = ((uint64_t)hbi->pos << BITS_PER_LEVEL) + ffsl(cur) - 1; + item = ((uint64_t)hbi->pos << BITS_PER_LEVEL) + bitops_ctzl(cur); return item << hbi->granularity; } |