diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-02-19 12:06:37 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-02-23 10:46:16 +0100 |
commit | d4b1425b604b8be9fc35cefe45d00cfecbac39e9 (patch) | |
tree | 9a04b4cf82a014cf42319ee6edde43f925b8c2cb /sql/sys_vars.ic | |
parent | ab2a9600a7b26cb6176e7fb62e029483fc821750 (diff) | |
download | mariadb-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 'sql/sys_vars.ic')
-rw-r--r-- | sql/sys_vars.ic | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sql/sys_vars.ic b/sql/sys_vars.ic index 2badd5d997a..373f5834838 100644 --- a/sql/sys_vars.ic +++ b/sql/sys_vars.ic @@ -1094,9 +1094,6 @@ public: } }; -// overflow-safe (1 << X)-1 -#define MAX_SET(X) ((((1UL << ((X)-1))-1) << 1) | 1) - /** The class for flagset variables - a variant of SET that allows in-place editing (turning on/off individual bits). String representations looks like @@ -1131,7 +1128,7 @@ public: global_var(ulonglong)= def_val; SYSVAR_ASSERT(typelib.count > 1); SYSVAR_ASSERT(typelib.count <= 65); - SYSVAR_ASSERT(def_val < MAX_SET(typelib.count)); + SYSVAR_ASSERT(def_val < my_set_bits(typelib.count)); SYSVAR_ASSERT(strcmp(values[typelib.count-1], "default") == 0); SYSVAR_ASSERT(size == sizeof(ulonglong)); } @@ -1179,7 +1176,7 @@ public: { longlong tmp=var->value->val_int(); if ((tmp < 0 && ! var->value->unsigned_flag) - || (ulonglong)tmp > MAX_SET(typelib.count)) + || (ulonglong)tmp > my_set_bits(typelib.count)) return true; else var->save_result.ulonglong_value= tmp; @@ -1240,7 +1237,7 @@ public: global_var(ulonglong)= def_val; SYSVAR_ASSERT(typelib.count > 0); SYSVAR_ASSERT(typelib.count <= 64); - SYSVAR_ASSERT(def_val <= MAX_SET(typelib.count)); + SYSVAR_ASSERT(def_val <= my_set_bits(typelib.count)); SYSVAR_ASSERT(size == sizeof(ulonglong)); } bool do_check(THD *thd, set_var *var) @@ -1278,7 +1275,7 @@ public: { longlong tmp=var->value->val_int(); if ((tmp < 0 && ! var->value->unsigned_flag) - || (ulonglong)tmp > MAX_SET(typelib.count)) + || (ulonglong)tmp > my_set_bits(typelib.count)) return true; else var->save_result.ulonglong_value= tmp; |