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 #include <string.h>
14
15 int ffsl(long int i);
16
17 int ffsll(long long int i);
18
19 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
20
21 ffs():
22 Since glibc 2.12:
23 _SVID_SOURCE || _BSD_SOURCE || _POSIX_C_SOURCE >= 200809L ||
24 _XOPEN_SOURCE >= 700 ||
25 Before glibc 2.12:
26 none
27 ffsl(), ffsll():
28 _GNU_SOURCE
29
31 The ffs() function returns the position of the first (least signifi‐
32 cant) bit set in the word i. The least significant bit is position 1
33 and the most significant position is, for example, 32 or 64. The func‐
34 tions ffsll() and ffsl() do the same but take arguments of possibly
35 different size.
36
38 These functions return the position of the first bit set, or 0 if no
39 bits are set in i.
40
42 ffs(): 4.3BSD, POSIX.1-2001.
43
44 The ffsl() and ffsll() functions are glibc extensions.
45
47 BSD systems have a prototype in <string.h>.
48
50 memchr(3)
51
53 This page is part of release 3.53 of the Linux man-pages project. A
54 description of the project, and information about reporting bugs, can
55 be found at http://www.kernel.org/doc/man-pages/.
56
57
58
59GNU 2010-09-20 FFS(3)