xfs
[Top] [All Lists]

xfs_lowbit32 implementation

To: "xfs@xxxxxxxxxxx" <xfs@xxxxxxxxxxx>
Subject: xfs_lowbit32 implementation
From: "Barry Naujok" <bnaujok@xxxxxxx>
Date: Mon, 28 Jul 2008 17:00:48 +1000
Organization: SGI
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Opera Mail/9.50 (Win32)
More of this libxfs port of the kernel (who cleaned up xfs_bit.*!)...

Anyway...

/* Get low bit set out of 32-bit argument, -1 if none set */
static inline int xfs_lowbit32(__uint32_t v)
{
        unsigned long   t = v;
        return (v) ? find_first_bit(&t, 32) : -1;
}


Couldn't that be:


/* Get low bit set out of 32-bit argument, -1 if none set */
static inline int xfs_lowbit32(__uint32_t v)
{
        return ffs(v) - 1;
}




<Prev in Thread] Current Thread [Next in Thread>
  • xfs_lowbit32 implementation, Barry Naujok <=