optimize legacy ffs function

This commit is contained in:
Rich Felker committed 2012-08-23 14:38:34 -04:00
1 parent a749ba3adc
commit 67ba40d1e0
1 file changed
+2 -4
+2 -4
View File
@@ -1,9 +1,7 @@
#include <strings.h>
#include "atomic.h"
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;
}