x86/oprofile: remove some local variables in MSR save/restore functions
[safe/jmp/linux-2.6] / fs / xfs / xfs_bit.h
index 325a007..f1e3c90 100644 (file)
  */
 
 /*
- * masks with n high/low bits set, 32-bit values & 64-bit values
+ * masks with n high/low bits set, 64-bit values
  */
-#define        XFS_MASK32HI(n)         xfs_mask32hi(n)
-static inline __uint32_t xfs_mask32hi(int n)
-{
-       return (__uint32_t)-1 << (32 - (n));
-}
-#define        XFS_MASK64HI(n)         xfs_mask64hi(n)
 static inline __uint64_t xfs_mask64hi(int n)
 {
        return (__uint64_t)-1 << (64 - (n));
 }
-#define        XFS_MASK32LO(n)         xfs_mask32lo(n)
 static inline __uint32_t xfs_mask32lo(int n)
 {
        return ((__uint32_t)1 << (n)) - 1;
 }
-#define        XFS_MASK64LO(n)         xfs_mask64lo(n)
 static inline __uint64_t xfs_mask64lo(int n)
 {
        return ((__uint64_t)1 << (n)) - 1;
@@ -61,15 +53,23 @@ static inline int xfs_highbit64(__uint64_t v)
 /* Get low bit set out of 32-bit argument, -1 if none set */
 static inline int xfs_lowbit32(__uint32_t v)
 {
-       __uint32_t t = v;
-       return (t) ? find_first_bit((unsigned long *)&t, 32) : -1;
+       return ffs(v) - 1;
 }
 
 /* Get low bit set out of 64-bit argument, -1 if none set */
 static inline int xfs_lowbit64(__uint64_t v)
 {
-       __uint64_t t = v;
-       return (t) ? find_first_bit((unsigned long *)&t, 64) : -1;
+       __uint32_t      w = (__uint32_t)v;
+       int             n = 0;
+
+       if (w) {        /* lower bits */
+               n = ffs(w);
+       } else {        /* upper bits */
+               w = (__uint32_t)(v >> 32);
+               if (w && (n = ffs(w)))
+               n += 32;
+       }
+       return n - 1;
 }
 
 /* Return whether bitmap is empty (1 == empty) */