projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
implement mbtowc directly, not as a wrapper for mbrtowc
[musl]
/
src
/
misc
/
ffs.c
diff --git
a/src/misc/ffs.c
b/src/misc/ffs.c
index
2f7cb32
..
673ce5a
100644
(file)
--- a/
src/misc/ffs.c
+++ b/
src/misc/ffs.c
@@
-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;
- for (i=1; j && !(j&1); j>>=1, i++);
- if (j) return i;
- return 0;
+ return i ? a_ctz_l(i)+1 : 0;
}
}