ffsffslffsllflsflslflsll
- find first or last bit set in a bit string
LIBRARY
Lb libc
SYNOPSIS
#include <strings.h> int
ffs (int value); int
ffsl (long value); intint
ffsll (long long value);
fls (int value); int
flsl (long value); int
flsll (long long value);
DESCRIPTION
The
ffs (,);
ffsl ();
and
ffsll ();
functions find the first bit set
(beginning with the least significant bit)
in
Fa value
and return the index of that bit.
The
fls (,);
flsl ();
and
flsll ();
functions find the last bit set in
Fa value
and return the index of that bit.
Bits are numbered starting at 1 (the least significant bit).
A return value of zero from any of these functions means that the
argument was zero.
The
ffs ();
function appeared in
BSD 4.3
Its prototype existed previously in
#include <string.h>
before it was moved to
#include <strings.h>
for
St -p1003.1-2001
compliance.
The
ffsl (,);
fls ();
and
flsl ();
functions appeared in
Fx 5.3 .
The
ffsll ();
and
flsll ();
functions appeared in
Fx 8.0 .