FFS(3C) Standard C Library Functions FFS(3C)
ffs - find first set bit
#include <strings.h>
int ffs(int i);
int ffsl(long i);
int ffsll(long long i);
int fls(int i);
int flsl(long i);
int flsll(long long i);
The ffs(), ffsl(), and ffsll() functions finds the first bit set
(beginning with the least significant bit) and return the index of
that bit. Bits are numbered starting at one (the least significant
bit).
The fls(), flsl(), and flsll() functions find the last bit set
(beginning with the least significant bit) and return the index of
that bit. Bits are numbered starting at one (the least significant
bit).
The ffs(), ffsl(), and ffsll() functions returns the index of the
first bit set. If i is 0, then they return 0.
The fls(), flsl(), and flsll() functions return the index of the last
bit set. If i is 0, then they return 0.
No errors are defined.
See attributes(7) for descriptions of the following attributes:
+--------------------+-----------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------+-----------------+
|Interface Stability | Committed |
+--------------------+-----------------+
|MT-Level | MT-Safe |
+--------------------+-----------------+
attributes(7), standards(7)
May 21, 2015 FFS(3C)
NAME
ffs - find first set bit
SYNOPSIS
#include <strings.h>
int ffs(int i);
int ffsl(long i);
int ffsll(long long i);
int fls(int i);
int flsl(long i);
int flsll(long long i);
DESCRIPTION
The ffs(), ffsl(), and ffsll() functions finds the first bit set
(beginning with the least significant bit) and return the index of
that bit. Bits are numbered starting at one (the least significant
bit).
The fls(), flsl(), and flsll() functions find the last bit set
(beginning with the least significant bit) and return the index of
that bit. Bits are numbered starting at one (the least significant
bit).
RETURN VALUES
The ffs(), ffsl(), and ffsll() functions returns the index of the
first bit set. If i is 0, then they return 0.
The fls(), flsl(), and flsll() functions return the index of the last
bit set. If i is 0, then they return 0.
ERRORS
No errors are defined.
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
+--------------------+-----------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------+-----------------+
|Interface Stability | Committed |
+--------------------+-----------------+
|MT-Level | MT-Safe |
+--------------------+-----------------+
SEE ALSO
attributes(7), standards(7)
May 21, 2015 FFS(3C)