[Commits] a29db06: Changed the function my_set_bits() to return uint64 instead of uint32.

IgorBabaev igor at mariadb.com
Tue Aug 15 03:05:41 EEST 2017


revision-id: a29db061cb15db1499006fe22fcd8447beebbdf9 (mariadb-10.2.2-589-ga29db06)
parent(s): 0f554dd0fdc54a07e38d6fd28b2f79a3dfc08713
author: Igor Babaev
committer: Igor Babaev
timestamp: 2017-08-14 17:05:41 -0700
message:

Changed the function my_set_bits() to return uint64 instead of uint32.
Corrected an assertion in the constructor for the class Sys_var_flagset.

---
 include/my_bit.h | 4 ++--
 sql/sys_vars.ic  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/my_bit.h b/include/my_bit.h
index 01cad95..0afefff 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 f9acfb3..ade2928 100644
--- a/sql/sys_vars.ic
+++ b/sql/sys_vars.ic
@@ -1230,7 +1230,7 @@ class Sys_var_flagset: public Sys_var_typelib
     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));
   }


More information about the commits mailing list