lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 06 Nov 2013 12:52:43 +0100
From:	Clemens Ladisch <clemens@...isch.de>
To:	Ben Greear <greearb@...delatech.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ