isa_common: find next bit faster
Since ffs is no longer implemented with a linear search, find_next_bit can work in constant time, with masking. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D41251
This commit is contained in:
@@ -275,12 +275,7 @@ find_first_bit(uint32_t mask)
|
||||
static int
|
||||
find_next_bit(uint32_t mask, int bit)
|
||||
{
|
||||
bit++;
|
||||
while (bit < 32 && !(mask & (1 << bit)))
|
||||
bit++;
|
||||
if (bit != 32)
|
||||
return (bit);
|
||||
return (-1);
|
||||
return (find_first_bit(mask & (-2 << bit)));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user