1FFS(3) Linux Programmer's Manual FFS(3)
2
3
4
6 ffs - find first bit set in a word
7
9 #include <strings.h>
10
11 int ffs(int i);
12
13 #define _GNU_SOURCE
14 #include <string.h>
15
16 int ffsl(long int i);
17
18 int ffsll(long long int i);
19
21 The ffs() function returns the position of the first (least signifi‐
22 cant) bit set in the word i. The least significant bit is position 1
23 and the most significant position e.g. 32 or 64. The functions
24 ffsll() and ffsl() do the same but take arguments of possibly different
25 size.
26
28 These functions return the position of the first bit set, or 0 if no
29 bits are set in i.
30
32 4.3BSD, POSIX.1-2001.
33
35 BSD systems have a prototype in <string.h>.
36
38 feature_test_macros(7)
39
40
41
42GNU 2003-08-05 FFS(3)