Re: Is __ffs64 supposed to be zero based?

From: Ben Greear
Date: Wed Nov 06 2013 - 12:17:12 EST

On 11/06/2013 03:52 AM, Clemens Ladisch wrote:
> Ben Greear wrote:
>> Similarly named methods elsewhere seem to indicate it is supposed to be
>> ones-based counting (ie, bit (1<<0) would be considred 'bit 1'.
> ffs() is defined to use one-based counting:
> <>
> __ffs() uses zero-based counting. On gcc, it's likely to be implemented
> with__builtin_ctz*(), whose documentation says:
> | Returns the number of trailing 0-bits in x, starting at the least
> | significant bit position.

Thanks for the information!


Ben Greear <greearb@xxxxxxxxxxxxxxx>
Candela Technologies Inc

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at