mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 15:15:46 +00:00
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>
This commit is contained in:
committed by
Blue Swirl
parent
7b2d977981
commit
fbeadf50f2
@ -126,7 +126,7 @@ unsigned long hbitmap_iter_skip_words(HBitmapIter *hbi)
|
||||
* The index of this word's least significant set bit provides
|
||||
* the low-order bits.
|
||||
*/
|
||||
pos = (pos << BITS_PER_LEVEL) + ffsl(cur) - 1;
|
||||
pos = (pos << BITS_PER_LEVEL) + bitops_ctzl(cur);
|
||||
hbi->cur[i] = cur & (cur - 1);
|
||||
|
||||
/* Set up next level for iteration. */
|
||||
|
Reference in New Issue
Block a user