mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06: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:
parent
7b2d977981
commit
fbeadf50f2
6 changed files with 28 additions and 65 deletions
|
@ -60,7 +60,7 @@ found_first:
|
|||
return result + size; /* Nope. */
|
||||
}
|
||||
found_middle:
|
||||
return result + bitops_ffsl(tmp);
|
||||
return result + bitops_ctzl(tmp);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -109,7 +109,7 @@ found_first:
|
|||
return result + size; /* Nope. */
|
||||
}
|
||||
found_middle:
|
||||
return result + ffz(tmp);
|
||||
return result + bitops_ctol(tmp);
|
||||
}
|
||||
|
||||
unsigned long find_last_bit(const unsigned long *addr, unsigned long size)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue