Commit 596bdc2d authored by Igor Babaev's avatar Igor Babaev

Changed the function my_set_bits() to return uint64 instead of uint32.

Corrected an assertion in the constructor for the class Sys_var_flagset.
parent 9d853230
...@@ -119,9 +119,9 @@ static inline uint32 my_reverse_bits(uint32 key) ...@@ -119,9 +119,9 @@ static inline uint32 my_reverse_bits(uint32 key)
a number with the n lowest bits set a number with the n lowest bits set
an overflow-safe version of (1 << n) - 1 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 C_MODE_END
......
...@@ -1230,7 +1230,7 @@ public: ...@@ -1230,7 +1230,7 @@ public:
global_var(ulonglong)= def_val; global_var(ulonglong)= def_val;
SYSVAR_ASSERT(typelib.count > 1); SYSVAR_ASSERT(typelib.count > 1);
SYSVAR_ASSERT(typelib.count <= 65); 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(strcmp(values[typelib.count-1], "default") == 0);
SYSVAR_ASSERT(size == sizeof(ulonglong)); SYSVAR_ASSERT(size == sizeof(ulonglong));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment