ffs - General: Finds the first set bit in a mask
int ffs(
long mask );
Specifies a bit mask with 0 (zero) or more bits set.
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.
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.
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)
[ Back ] |