implement get_next_higher_bit using get_highest_on_bit to benefit from optimisations

This commit is contained in:
rdb 2014-12-12 19:16:26 +01:00
parent a0409c54c1
commit 09741ecf33
1 changed files with 3 additions and 6 deletions

View File

@ -267,8 +267,7 @@ get_highest_on_bit(PN_uint64 x) {
////////////////////////////////////////////////////////////////////
INLINE int
get_next_higher_bit(PN_uint16 x) {
PN_uint16 w = flood_bits_down(x);
return count_bits_in_word(w);
return get_highest_on_bit(x) + 1;
}
////////////////////////////////////////////////////////////////////
@ -280,8 +279,7 @@ get_next_higher_bit(PN_uint16 x) {
////////////////////////////////////////////////////////////////////
INLINE int
get_next_higher_bit(PN_uint32 x) {
PN_uint32 w = flood_bits_down(x);
return count_bits_in_word(w);
return get_highest_on_bit(x) + 1;
}
////////////////////////////////////////////////////////////////////
@ -293,6 +291,5 @@ get_next_higher_bit(PN_uint32 x) {
////////////////////////////////////////////////////////////////////
INLINE int
get_next_higher_bit(PN_uint64 x) {
PN_uint64 w = flood_bits_down(x);
return count_bits_in_word(w);
return get_highest_on_bit(x) + 1;
}