mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
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:
parent
fa3cf6cdc6
commit
c2cbd7ffa7
1 changed files with 1 additions and 6 deletions
|
|
@ -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)));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue