[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <52615.1240839635@turing-police.cc.vt.edu>
Date: Mon, 27 Apr 2009 09:40:35 -0400
From: Valdis.Kletnieks@...edu
To: Steven Whitehouse <swhiteho@...hat.com>
Cc: linux-kernel@...r.kernel.org, cluster-devel@...hat.com
Subject: Re: [PATCH 1/3] bitops: Add __ffs64 bitop
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?
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists