1 FFS(3C) Standard C Library Functions FFS(3C) 2 3 4 5 NAME 6 ffs - find first set bit 7 8 SYNOPSIS 9 #include <strings.h> 10 11 int ffs(int i); 12 13 int ffsl(ong i); 14 15 int ffsll(long long i); 16 17 int fls(int i); 18 19 int flsl(long i); 20 21 int flsll(long long i); 22 23 24 DESCRIPTION 25 The ffs(), ffsl(), and ffsll() functions finds the first bit set 26 (beginning with the least significant bit) and return the index of that 27 bit. Bits are numbered starting at one (the least significant bit). 28 29 30 The fls(), flsl(), and flsll() functions find the last bit set 31 (beginning with the least significant bit) and return the index of that 32 bit. Bits are numbered starting at one (the least significant bit). 33 34 RETURN VALUES 35 The ffs(), ffsl(), and ffsll() functions returns the index of the first 36 bit set. If i is 0, then they return 0. 37 38 39 The fls(), flsl(), and flsll() functions return the index of the last 40 bit set. If i is 0, then they return 0. 41 42 ERRORS 43 No errors are defined. 44 45 ATTRIBUTES 46 See attributes(5) for descriptions of the following attributes: 47 48 49 50 51 +--------------------+-----------------+ 52 | ATTRIBUTE TYPE | ATTRIBUTE VALUE | 53 +--------------------+-----------------+ 54 |Interface Stability | Committed | 55 +--------------------+-----------------+ 56 |MT-Level | MT-Safe | 57 +--------------------+-----------------+ 58 59 SEE ALSO 60 attributes(5), standards(5) 61 62 63 64 May 21, 2015 FFS(3C)