From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] Re: [PATCH 1/3] bitops: Add __ffs64 bitop
Date: Mon, 27 Apr 2009 16:41:06 +0100 [thread overview]
Message-ID: <1240846866.29604.122.camel@localhost.localdomain> (raw)
In-Reply-To: <52615.1240839635@turing-police.cc.vt.edu>
Hi,
On Mon, 2009-04-27 at 09:40 -0400, Valdis.Kletnieks at vt.edu wrote:
> On Thu, 23 Apr 2009 10:16:54 BST, Steven Whitehouse said:
> > Finds the first set bit in a 64 bit word. This is required in order
> > to fix a bug in GFS2, but I think it should be a generic function
> > in case of future users.
>
> Seems like a sane idea..
>
> > +static inline unsigned long __ffs64(u64 word)
> > +{
> > +#if BITS_PER_LONG == 32
> > + if (((u32)word) == 0UL)
> > + return __ffs((u32)(word >> 32)) + 32;
> > +#elif BITS_PER_LONG != 64
> > +#error BITS_PER_LONG not 32 or 64
> > +#endif
> > + return __ffs((unsigned long)word);
> > +}
> > +
>
> Does this have endian-ness issues (is that (u32)word the "high" or "low"
> part)? Or is this intended only for looking at bitmaps and the like, and we
> don't really care?
The intent was that it would operate on native endian u64 words so that
it shouldn't be affected by the endianess. In the GFS2 code where it is
used, the byte ordering is converted to native order before this
function is applied,
Steve.
prev parent reply other threads:[~2009-04-27 15:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-23 9:16 [Cluster-devel] GFS2: Block alloc fixes Steven Whitehouse
2009-04-23 9:16 ` [Cluster-devel] [PATCH 1/3] bitops: Add __ffs64 bitop Steven Whitehouse
2009-04-23 9:16 ` [Cluster-devel] [PATCH 2/3] GFS2: Fix bug in block allocation Steven Whitehouse
2009-04-23 9:16 ` [Cluster-devel] [PATCH 3/3] GFS2: Ensure that the inode goal block settings are updated Steven Whitehouse
[not found] ` <52615.1240839635@turing-police.cc.vt.edu>
2009-04-27 15:41 ` Steven Whitehouse [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=1240846866.29604.122.camel@localhost.localdomain \
--to=swhiteho@redhat.com \
/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