summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-02-19 12:06:37 +0100
committerSergei Golubchik <serg@mariadb.org>2016-02-23 10:46:16 +0100
commitd4b1425b604b8be9fc35cefe45d00cfecbac39e9 (patch)
tree9a04b4cf82a014cf42319ee6edde43f925b8c2cb /include
parentab2a9600a7b26cb6176e7fb62e029483fc821750 (diff)
downloadmariadb-git-d4b1425b604b8be9fc35cefe45d00cfecbac39e9.tar.gz
cleanup
* make a local variable for target_table->field[col] * move an often-used bit function to my_bit.h * remove a non-static and not really needed trivial comparison function with a very generic name
Diffstat (limited to 'include')
-rw-r--r--include/my_bit.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/my_bit.h b/include/my_bit.h
index 174e0f70083..a50403c312d 100644
--- a/include/my_bit.h
+++ b/include/my_bit.h
@@ -121,6 +121,15 @@ static inline uint32 my_reverse_bits(uint32 key)
_my_bits_reverse_table[(key>>24) ];
}
+/*
+ a number with the n lowest bits set
+ an overflow-safe version of (1 << n) - 1
+*/
+static inline uint32 my_set_bits(int n)
+{
+ return (((1UL << (n - 1)) - 1) << 1) | 1;
+}
+
C_MODE_END
#endif /* MY_BIT_INCLUDED */