blob: 7e29487d5fbc7cfed599b5e0cfa734cdde0813c7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#include <strings.h>
int ffs(int i)
{
int bit = 0;
if (i == 0) {
return 0;
}
while (!(i & (1 << bit))) {
bit++;
}
return bit;
}
/*
XOPEN(400)
*/
|