summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2017-08-14 17:05:41 -0700
committerIgor Babaev <igor@askmonty.org>2017-08-14 17:06:11 -0700
commit596bdc2dbe5c81303e9dca3e27f070edd7bfa92f (patch)
tree8f770966588cb89210239fb42804cd72cb8dfc67
parent9d853230077a97db819abc69a9197ab0b5f5aff2 (diff)
downloadmariadb-git-596bdc2dbe5c81303e9dca3e27f070edd7bfa92f.tar.gz
Changed the function my_set_bits() to return uint64 instead of uint32.
Corrected an assertion in the constructor for the class Sys_var_flagset.
-rw-r--r--include/my_bit.h4
-rw-r--r--sql/sys_vars.ic2
2 files changed, 3 insertions, 3 deletions
diff --git a/include/my_bit.h b/include/my_bit.h
index 01cad95792c..0afeffff918 100644
--- a/include/my_bit.h
+++ b/include/my_bit.h
@@ -119,9 +119,9 @@ static inline uint32 my_reverse_bits(uint32 key)
a number with the n lowest bits set
an overflow-safe version of (1 << n) - 1
*/
-static inline uint32 my_set_bits(int n)
+static inline uint64 my_set_bits(int n)
{
- return (((1UL << (n - 1)) - 1) << 1) | 1;
+ return (((1ULL << (n - 1)) - 1) << 1) | 1;
}
C_MODE_END
diff --git a/sql/sys_vars.ic b/sql/sys_vars.ic
index f9acfb3b657..ade2928f4c2 100644
--- a/sql/sys_vars.ic
+++ b/sql/sys_vars.ic
@@ -1230,7 +1230,7 @@ public:
global_var(ulonglong)= def_val;
SYSVAR_ASSERT(typelib.count > 1);
SYSVAR_ASSERT(typelib.count <= 65);
- SYSVAR_ASSERT(def_val < my_set_bits(typelib.count));
+ SYSVAR_ASSERT(def_val <= my_set_bits(typelib.count-1));
SYSVAR_ASSERT(strcmp(values[typelib.count-1], "default") == 0);
SYSVAR_ASSERT(size == sizeof(ulonglong));
}