lkml.org 
[lkml]   [2013]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Is __ffs64 supposed to be zero based?
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:
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/ffs.html>

__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.


Regards,
Clemens


\
 
 \ /
  Last update: 2013-11-06 19:41    [W:0.031 / U:2.928 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site