ffs

Finds the first set bit.

Synopsis

int ffs( uint32 mask )

Description

ffs finds the lowest-numbered bit that is set in the argument. The least-significant bit is bit number 1, and the most-significant bit is bit 32.

Arguments

flags
The 32-bit word to check

Return Value

ffs returns zero if no bits are set in the parameter, or the bit index of the first bit is set in the parameter. For example, ffs returns 1 if the value of the argument is 1 or 3 or 7; and 3 if the value of the argument is 4 or 12. If no bits are set, ffs returns 0.

Implementation

Convenience call implemented in clib.lib V20.

Associated Files

clib.lib
ARM Link Library

Notes

This entry point is provided for portability and compatibility only; code written specifically for Portfolio should use FindLSB() or FindMSB() to reduce any ambiguity over whether the least-significant or most-significant bit is desired.

See Also

FindMSB(), FindLSB()