From: Ben Greear <greearb@candelatech.com>
To: Clemens Ladisch <clemens@ladisch.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Is __ffs64 supposed to be zero based?
Date: Wed, 06 Nov 2013 09:17:03 -0800 [thread overview]
Message-ID: <527A798F.7020809@candelatech.com> (raw)
In-Reply-To: <527A2D8B.6030901@ladisch.de>
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:
> <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.
Thanks for the information!
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
prev parent reply other threads:[~2013-11-06 17:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-06 7:15 Is __ffs64 supposed to be zero based? Ben Greear
2013-11-06 11:52 ` Clemens Ladisch
2013-11-06 17:17 ` Ben Greear [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=527A798F.7020809@candelatech.com \
--to=greearb@candelatech.com \
--cc=clemens@ladisch.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.