aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/find_next_bit.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/lib/find_next_bit.c b/lib/find_next_bit.c
index 5820e072b890..ce94c4c92d10 100644
--- a/lib/find_next_bit.c
+++ b/lib/find_next_bit.c
@@ -15,17 +15,12 @@
15#include <asm/byteorder.h> 15#include <asm/byteorder.h>
16 16
17#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG) 17#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
18#undef find_next_bit 18
19#undef find_next_zero_bit 19/*
20 20 * Find the next set bit in a memory region.
21/**
22 * find_next_bit - find the next set bit in a memory region
23 * @addr: The address to base the search on
24 * @offset: The bitnumber to start searching at
25 * @size: The maximum size to search
26 */ 21 */
27unsigned long find_next_bit(const unsigned long *addr, unsigned long size, 22unsigned long __find_next_bit(const unsigned long *addr,
28 unsigned long offset) 23 unsigned long size, unsigned long offset)
29{ 24{
30 const unsigned long *p = addr + BITOP_WORD(offset); 25 const unsigned long *p = addr + BITOP_WORD(offset);
31 unsigned long result = offset & ~(BITS_PER_LONG-1); 26 unsigned long result = offset & ~(BITS_PER_LONG-1);
@@ -62,15 +57,14 @@ found_first:
62found_middle: 57found_middle:
63 return result + __ffs(tmp); 58 return result + __ffs(tmp);
64} 59}
65 60EXPORT_SYMBOL(__find_next_bit);
66EXPORT_SYMBOL(find_next_bit);
67 61
68/* 62/*
69 * This implementation of find_{first,next}_zero_bit was stolen from 63 * This implementation of find_{first,next}_zero_bit was stolen from
70 * Linus' asm-alpha/bitops.h. 64 * Linus' asm-alpha/bitops.h.
71 */ 65 */
72unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size, 66unsigned long __find_next_zero_bit(const unsigned long *addr,
73 unsigned long offset) 67 unsigned long size, unsigned long offset)
74{ 68{
75 const unsigned long *p = addr + BITOP_WORD(offset); 69 const unsigned long *p = addr + BITOP_WORD(offset);
76 unsigned long result = offset & ~(BITS_PER_LONG-1); 70 unsigned long result = offset & ~(BITS_PER_LONG-1);
@@ -107,8 +101,7 @@ found_first:
107found_middle: 101found_middle:
108 return result + ffz(tmp); 102 return result + ffz(tmp);
109} 103}
110 104EXPORT_SYMBOL(__find_next_zero_bit);
111EXPORT_SYMBOL(find_next_zero_bit);
112 105
113#ifdef __BIG_ENDIAN 106#ifdef __BIG_ENDIAN
114 107