]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/asm-i386/bitops.h
MIPS: Namespace pollution: dump_regs() -> elf_dump_regs()
[linux-2.6-omap-h63xx.git] / include / asm-i386 / bitops.h
index 4807aa1d2e3d865fe41c70045da8d4ccd0a4bbfc..65679aca4b2229ffb4e5b1781363ee8f10ef8efd 100644 (file)
@@ -332,9 +332,9 @@ static inline unsigned long __ffs(unsigned long word)
  * Returns the bit-number of the first set bit, not the number of the byte
  * containing a bit.
  */
-static inline int find_first_bit(const unsigned long *addr, unsigned size)
+static inline unsigned find_first_bit(const unsigned long *addr, unsigned size)
 {
-       int x = 0;
+       unsigned x = 0;
 
        while (x < size) {
                unsigned long val = *addr++;
@@ -367,11 +367,6 @@ static inline unsigned long ffz(unsigned long word)
        return word;
 }
 
-/*
- * fls: find last bit set.
- */
-
-#define fls(x) generic_fls(x)
 #define fls64(x)   generic_fls64(x)
 
 #ifdef __KERNEL__
@@ -414,6 +409,23 @@ static inline int ffs(int x)
        return r+1;
 }
 
+/**
+ * fls - find last bit set
+ * @x: the word to search
+ *
+ * This is defined the same way as ffs.
+ */
+static inline int fls(int x)
+{
+       int r;
+
+       __asm__("bsrl %1,%0\n\t"
+               "jnz 1f\n\t"
+               "movl $-1,%0\n"
+               "1:" : "=r" (r) : "rm" (x));
+       return r+1;
+}
+
 /**
  * hweightN - returns the hamming weight of a N-bit word
  * @x: the word to weigh