]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/asm-powerpc/bitops.h
x86: bitops take an unsigned long *
[linux-2.6-omap-h63xx.git] / include / asm-powerpc / bitops.h
index 220d9a781ab9c0f64030f15e45543472a950de2f..897eade3afbeb0109159de4e1eb855f42ddab4e0 100644 (file)
@@ -312,24 +312,31 @@ static __inline__ int fls(unsigned int x)
        asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x));
        return 32 - lz;
 }
-#include <asm-generic/bitops/fls64.h>
 
-#include <asm-generic/bitops/hweight.h>
+static __inline__ unsigned long __fls(unsigned long x)
+{
+       return __ilog2(x);
+}
 
-#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
-unsigned long find_next_zero_bit(const unsigned long *addr,
-                                unsigned long size, unsigned long offset);
-/**
- * find_first_bit - find the first set bit in a memory region
- * @addr: The address to start the search at
- * @size: The maximum size to search
- *
- * Returns the bit-number of the first set bit, not the number of the byte
- * containing a bit.
+/*
+ * 64-bit can do this using one cntlzd (count leading zeroes doubleword)
+ * instruction; for 32-bit we use the generic version, which does two
+ * 32-bit fls calls.
  */
-#define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
-unsigned long find_next_bit(const unsigned long *addr,
-                           unsigned long size, unsigned long offset);
+#ifdef __powerpc64__
+static __inline__ int fls64(__u64 x)
+{
+       int lz;
+
+       asm ("cntlzd %0,%1" : "=r" (lz) : "r" (x));
+       return 64 - lz;
+}
+#else
+#include <asm-generic/bitops/fls64.h>
+#endif /* __powerpc64__ */
+
+#include <asm-generic/bitops/hweight.h>
+#include <asm-generic/bitops/find.h>
 
 /* Little-endian versions */