mirror of
https://github.com/fluencelabs/musl
synced 2025-04-25 23:32:15 +00:00
optimize legacy ffs function
This commit is contained in:
parent
a749ba3adc
commit
67ba40d1e0
@ -1,9 +1,7 @@
|
|||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
#include "atomic.h"
|
||||||
|
|
||||||
int ffs(int i)
|
int ffs(int i)
|
||||||
{
|
{
|
||||||
unsigned int j = i;
|
return i ? a_ctz_l(i)+1 : 0;
|
||||||
for (i=1; j && !(j&1); j>>=1, i++);
|
|
||||||
if (j) return i;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user