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)); }