From: James Bottomley <James.Bottomley@steeleye.com>
To: LaMont Jones <lamont@hp.com>
Cc: Joel Soete <jsoe0708@tiscali.be>, parisc-linux@parisc-linux.org
Subject: Re: [parisc-linux] backport bitops.h stuff
Date: 01 Aug 2003 12:33:24 -0500 [thread overview]
Message-ID: <1059759205.1830.44.camel@mulgrave> (raw)
In-Reply-To: <20030801171426.GA18508@security.hp.com>
On Fri, 2003-08-01 at 12:14, LaMont Jones wrote:
> ffs(0)==31
> ffs(1)==0
> ffs(2)==1
> ffs(3)==0
> ffs(4)==2
> ffs(80000000)==31
This is off by one. The definition should say
ffs(0) == 0
ffs(1) == 1
ffs(2) == 2
ffs(4) == 3
...
ffs(0x80000000) == 32
i.e. it returns the first set bit starting counting at one. (Yes, I know
it's confusing, it's tripped me up, especially as ffz counts bits from
zero. However, ffs is a BSD standard).
Most arch's start by defining an __ffs which is not defined for the zero
case and then build the real ffs from that.
James
next prev parent reply other threads:[~2003-08-01 17:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-01 15:28 [parisc-linux] backport bitops.h stuff Joel Soete
2003-08-01 15:35 ` Joel Soete
2003-08-01 15:59 ` James Bottomley
2003-08-01 17:09 ` Joel Soete
2003-08-01 17:14 ` LaMont Jones
2003-08-01 17:25 ` Joel Soete
2003-08-01 17:33 ` James Bottomley [this message]
2003-08-04 10:43 ` Joel Soete
2003-08-04 15:14 ` LaMont Jones
2003-08-04 16:08 ` James Bottomley
2003-08-04 17:04 ` Joel Soete
2003-08-04 16:53 ` Joel Soete
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=1059759205.1830.44.camel@mulgrave \
--to=james.bottomley@steeleye.com \
--cc=jsoe0708@tiscali.be \
--cc=lamont@hp.com \
--cc=parisc-linux@parisc-linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox