aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2008-04-29 06:01:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 11:11:16 -0400
commitfee4b19fb3f28d17c0b9f9ea0668db5275697178 (patch)
tree0d7c34ef39cdac5a0c7f89376e85cc3ef621a7da /lib
parent8972331292753c89dbdd10b175e999ce78dc3be7 (diff)
bitops: remove "optimizations"
The mapsize optimizations which were moved from x86 to the generic code in commit 64970b68d2b3ed32b964b0b30b1b98518fde388e increased the binary size on non x86 architectures. Looking into the real effects of the "optimizations" it turned out that they are not used in find_next_bit() and find_next_zero_bit(). The ones in find_first_bit() and find_first_zero_bit() are used in a couple of places but none of them is a real hot path. Remove the "optimizations" all together and call the library functions unconditionally. Boot-tested on x86 and compile tested on every cross compiler I have. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-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