aboutsummaryrefslogtreecommitdiffstats
path: root/lib/find_next_bit.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/find_next_bit.c')
-rw-r--r--lib/find_next_bit.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/find_next_bit.c b/lib/find_next_bit.c
index d3f5784807b4..24c59ded47a0 100644
--- a/lib/find_next_bit.c
+++ b/lib/find_next_bit.c
@@ -20,8 +20,8 @@
20/* 20/*
21 * Find the next set bit in a memory region. 21 * Find the next set bit in a memory region.
22 */ 22 */
23unsigned long __find_next_bit(const unsigned long *addr, 23unsigned long find_next_bit(const unsigned long *addr, unsigned long size,
24 unsigned long size, unsigned long offset) 24 unsigned long offset)
25{ 25{
26 const unsigned long *p = addr + BITOP_WORD(offset); 26 const unsigned long *p = addr + BITOP_WORD(offset);
27 unsigned long result = offset & ~(BITS_PER_LONG-1); 27 unsigned long result = offset & ~(BITS_PER_LONG-1);
@@ -58,14 +58,14 @@ found_first:
58found_middle: 58found_middle:
59 return result + __ffs(tmp); 59 return result + __ffs(tmp);
60} 60}
61EXPORT_SYMBOL(__find_next_bit); 61EXPORT_SYMBOL(find_next_bit);
62 62
63/* 63/*
64 * This implementation of find_{first,next}_zero_bit was stolen from 64 * This implementation of find_{first,next}_zero_bit was stolen from
65 * Linus' asm-alpha/bitops.h. 65 * Linus' asm-alpha/bitops.h.
66 */ 66 */
67unsigned long __find_next_zero_bit(const unsigned long *addr, 67unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
68 unsigned long size, unsigned long offset) 68 unsigned long offset)
69{ 69{
70 const unsigned long *p = addr + BITOP_WORD(offset); 70 const unsigned long *p = addr + BITOP_WORD(offset);
71 unsigned long result = offset & ~(BITS_PER_LONG-1); 71 unsigned long result = offset & ~(BITS_PER_LONG-1);
@@ -102,15 +102,14 @@ found_first:
102found_middle: 102found_middle:
103 return result + ffz(tmp); 103 return result + ffz(tmp);
104} 104}
105EXPORT_SYMBOL(__find_next_zero_bit); 105EXPORT_SYMBOL(find_next_zero_bit);
106#endif /* CONFIG_GENERIC_FIND_NEXT_BIT */ 106#endif /* CONFIG_GENERIC_FIND_NEXT_BIT */
107 107
108#ifdef CONFIG_GENERIC_FIND_FIRST_BIT 108#ifdef CONFIG_GENERIC_FIND_FIRST_BIT
109/* 109/*
110 * Find the first set bit in a memory region. 110 * Find the first set bit in a memory region.
111 */ 111 */
112unsigned long __find_first_bit(const unsigned long *addr, 112unsigned long find_first_bit(const unsigned long *addr, unsigned long size)
113 unsigned long size)
114{ 113{
115 const unsigned long *p = addr; 114 const unsigned long *p = addr;
116 unsigned long result = 0; 115 unsigned long result = 0;
@@ -131,13 +130,12 @@ unsigned long __find_first_bit(const unsigned long *addr,
131found: 130found:
132 return result + __ffs(tmp); 131 return result + __ffs(tmp);
133} 132}
134EXPORT_SYMBOL(__find_first_bit); 133EXPORT_SYMBOL(find_first_bit);
135 134
136/* 135/*
137 * Find the first cleared bit in a memory region. 136 * Find the first cleared bit in a memory region.
138 */ 137 */
139unsigned long __find_first_zero_bit(const unsigned long *addr, 138unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size)
140 unsigned long size)
141{ 139{
142 const unsigned long *p = addr; 140 const unsigned long *p = addr;
143 unsigned long result = 0; 141 unsigned long result = 0;
@@ -158,7 +156,7 @@ unsigned long __find_first_zero_bit(const unsigned long *addr,
158found: 156found:
159 return result + ffz(tmp); 157 return result + ffz(tmp);
160} 158}
161EXPORT_SYMBOL(__find_first_zero_bit); 159EXPORT_SYMBOL(find_first_zero_bit);
162#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ 160#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */
163 161
164#ifdef __BIG_ENDIAN 162#ifdef __BIG_ENDIAN