1FFS(3) Linux Programmer's Manual FFS(3)
2
3
4
6 ffs, ffsl, ffsll - 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 is, for example, 32 or 64. The func‐
24 tions ffsll() and ffsl() do the same but take arguments of possibly
25 different 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 ffs():4.3BSD,POSIX.1-2001. The ffsl() and ffsll() are glibc exten‐
33 sions.
34
36 BSD systems have a prototype in <string.h>.
37
39 memchr(3), feature_test_macros(7)
40
42 This page is part of release 3.25 of the Linux man-pages project. A
43 description of the project, and information about reporting bugs, can
44 be found at http://www.kernel.org/doc/man-pages/.
45
46
47
48GNU 2009-08-27 FFS(3)