linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / include / asm-sparc / bitops.h
index a0e09a7..41722b5 100644 (file)
@@ -298,6 +298,7 @@ static inline int ffs(int x)
  * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
  */
 #define fls(x) generic_fls(x)
+#define fls64(x)   generic_fls64(x)
 
 /*
  * hweightN: returns the hamming weight (i.e. the number
@@ -312,10 +313,10 @@ static inline int ffs(int x)
  * 'size' bits, starting the search at bit 'offset'. This is largely based
  * on Linus's ALPHA routines, which are pretty portable BTW.
  */
-static inline unsigned long find_next_zero_bit(unsigned long *addr,
+static inline unsigned long find_next_zero_bit(const unsigned long *addr,
     unsigned long size, unsigned long offset)
 {
-       unsigned long *p = addr + (offset >> 5);
+       const unsigned long *p = addr + (offset >> 5);
        unsigned long result = offset & ~31UL;
        unsigned long tmp;
 
@@ -366,9 +367,9 @@ found_middle:
  *
  * Scheduler induced bitop, do not use.
  */
-static inline int find_next_bit(unsigned long *addr, int size, int offset)
+static inline int find_next_bit(const unsigned long *addr, int size, int offset)
 {
-       unsigned long *p = addr + (offset >> 5);
+       const unsigned long *p = addr + (offset >> 5);
        int num = offset & ~0x1f;
        unsigned long word;
 
@@ -384,6 +385,17 @@ static inline int find_next_bit(unsigned long *addr, int size, int offset)
        return num;
 }
 
+/**
+ * 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.
+ */
+#define find_first_bit(addr, size) \
+       find_next_bit((addr), (size), 0)
+
 /*
  */
 static inline int test_le_bit(int nr, __const__ unsigned long * addr)
@@ -435,10 +447,10 @@ static inline int __test_and_clear_le_bit(int nr, unsigned long *addr)
        return retval;
 }
 
-static inline unsigned long find_next_zero_le_bit(unsigned long *addr,
+static inline unsigned long find_next_zero_le_bit(const unsigned long *addr,
     unsigned long size, unsigned long offset)
 {
-       unsigned long *p = addr + (offset >> 5);
+       const unsigned long *p = addr + (offset >> 5);
        unsigned long result = offset & ~31UL;
        unsigned long tmp;