summaryrefslogtreecommitdiff
path: root/include/my_bit.h
diff options
context:
space:
mode:
authorDavi Arnaut <davi.arnaut@oracle.com>2010-07-23 17:18:36 -0300
committerDavi Arnaut <davi.arnaut@oracle.com>2010-07-23 17:18:36 -0300
commitecd4a294a5d0ef4f0191993352bb0c1290e3c132 (patch)
treee39190b7222d99ca43735545cd66a9090e96e4ee /include/my_bit.h
parente001970cc7ca527ea7e81647d2fe4b6b5afd4478 (diff)
downloadmariadb-git-ecd4a294a5d0ef4f0191993352bb0c1290e3c132.tar.gz
WL#5498: Remove dead and unused source code
Remove wrappers around inline -- static inline is used without wrappers throughout the source code. We rely on the compiler or linker to eliminate unused static functions.
Diffstat (limited to 'include/my_bit.h')
-rw-r--r--include/my_bit.h21
1 files changed, 6 insertions, 15 deletions
diff --git a/include/my_bit.h b/include/my_bit.h
index 5cbf4f8b83e..b396b84b0d8 100644
--- a/include/my_bit.h
+++ b/include/my_bit.h
@@ -6,7 +6,6 @@
*/
C_MODE_START
-#ifdef HAVE_INLINE
extern const char _my_bits_nbits[256];
extern const uchar _my_bits_reverse_table[256];
@@ -16,14 +15,14 @@ extern const uchar _my_bits_reverse_table[256];
This can be used to divide a number with value by doing a shift instead
*/
-STATIC_INLINE uint my_bit_log2(ulong value)
+static inline uint my_bit_log2(ulong value)
{
uint bit;
for (bit=0 ; value > 1 ; value>>=1, bit++) ;
return bit;
}
-STATIC_INLINE uint my_count_bits(ulonglong v)
+static inline uint my_count_bits(ulonglong v)
{
#if SIZEOF_LONG_LONG > 4
/* The following code is a bit faster on 16 bit machines than if we would
@@ -45,7 +44,7 @@ STATIC_INLINE uint my_count_bits(ulonglong v)
#endif
}
-STATIC_INLINE uint my_count_bits_ushort(ushort v)
+static inline uint my_count_bits_ushort(ushort v)
{
return _my_bits_nbits[v];
}
@@ -70,7 +69,7 @@ STATIC_INLINE uint my_count_bits_ushort(ushort v)
Comments shows how this works with 01100000000000000000000000001011
*/
-STATIC_INLINE uint32 my_round_up_to_next_power(uint32 v)
+static inline uint32 my_round_up_to_next_power(uint32 v)
{
v--; /* 01100000000000000000000000001010 */
v|= v >> 1; /* 01110000000000000000000000001111 */
@@ -81,7 +80,7 @@ STATIC_INLINE uint32 my_round_up_to_next_power(uint32 v)
return v+1; /* 10000000000000000000000000000000 */
}
-STATIC_INLINE uint32 my_clear_highest_bit(uint32 v)
+static inline uint32 my_clear_highest_bit(uint32 v)
{
uint32 w=v >> 1;
w|= w >> 1;
@@ -92,7 +91,7 @@ STATIC_INLINE uint32 my_clear_highest_bit(uint32 v)
return v & w;
}
-STATIC_INLINE uint32 my_reverse_bits(uint32 key)
+static inline uint32 my_reverse_bits(uint32 key)
{
return
(_my_bits_reverse_table[ key & 255] << 24) |
@@ -101,14 +100,6 @@ STATIC_INLINE uint32 my_reverse_bits(uint32 key)
_my_bits_reverse_table[(key>>24) ];
}
-#else /* HAVE_INLINE */
-extern uint my_bit_log2(ulong value);
-extern uint32 my_round_up_to_next_power(uint32 v);
-uint32 my_clear_highest_bit(uint32 v);
-uint32 my_reverse_bits(uint32 key);
-extern uint my_count_bits(ulonglong v);
-extern uint my_count_bits_ushort(ushort v);
-#endif /* HAVE_INLINE */
C_MODE_END
#endif /* MY_BIT_INCLUDED */