summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 597ec4f68d0..633c0d96f2c 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -8696,7 +8696,13 @@ int Field_set::store(longlong nr, bool unsigned_val)
{
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int error= 0;
- ulonglong max_nr= set_bits(ulonglong, typelib->count);
+ ulonglong max_nr;
+
+ if (sizeof(ulonglong)*8 <= typelib->count)
+ max_nr= ULONGLONG_MAX;
+ else
+ max_nr= (ULL(1) << typelib->count) - 1;
+
if ((ulonglong) nr > max_nr)
{
nr&= max_nr;