ffs(9r) ffs(9r)
NAME
ffs - General: Finds the first set bit in a mask
SYNOPSIS
int ffs(
long mask );
ARGUMENTS
Specifies a bit mask with 0 (zero) or more bits set.
DESCRIPTION
The ffs routine returns the bit position of the first bit you set in the mask argument. The scan proceeds from the least significant bit
to the most significant bit of the mask.
NOTES
The ffs routine duplicates the behavior of the ffs instruction on the DIGITAL VAX series or computers. It is not present in architectures
that implement its function in hardware or through compiler inline substitution.
The ffs routine is useful for translating bits in a bit mask into bit positions. For example, the signal handling code uses it to analyze
the signal mask.
RETURN VALUES
Upon successful completion, ffs returns the bit position of the first bit set in the mask. If no bits were set in the mask, ffs returns the
value 0 (zero).
ffs(9r)