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:
Doug Moore 2023-07-31 21:02:56 -05:00
parent fa3cf6cdc6
commit c2cbd7ffa7

View file

@ -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)));
}
/*