2.2.1 int ffs

int ffs(int __val)

Remember:

The ffs() function returns the position of the first (least significant) bit set in the word val, or 0 if no bits are set. The least significant bit is position 1.

Note:

For expressions that are constant at compile time, consider using the _FFS macro instead.