Commit a4131c51 authored by Alexander Barkov's avatar Alexander Barkov

Merge remote-tracking branch 'origin/5.5' into bb-10.0-bar

parents acc97298 fc70f21e
...@@ -4027,7 +4027,7 @@ class Item_int_with_ref :public Item_int ...@@ -4027,7 +4027,7 @@ class Item_int_with_ref :public Item_int
Base class to implement typed value caching Item classes Base class to implement typed value caching Item classes
Item_copy_ classes are very similar to the corresponding Item_ Item_copy_ classes are very similar to the corresponding Item_
classes (e.g. Item_copy_int is similar to Item_int) but they add classes (e.g. Item_copy_string is similar to Item_string) but they add
the following additional functionality to Item_ : the following additional functionality to Item_ :
1. Nullability 1. Nullability
2. Possibility to store the value not only on instantiation time, 2. Possibility to store the value not only on instantiation time,
......
...@@ -33,7 +33,11 @@ class Longlong_hybrid ...@@ -33,7 +33,11 @@ class Longlong_hybrid
bool neg() const { return m_value < 0 && !m_unsigned; } bool neg() const { return m_value < 0 && !m_unsigned; }
ulonglong abs() const ulonglong abs() const
{ {
return neg() ? (ulonglong) -m_value : (ulonglong) m_value; if (m_unsigned)
return (ulonglong) m_value;
if (m_value == LONGLONG_MIN) // avoid undefined behavior
return ((ulonglong) LONGLONG_MAX) + 1;
return m_value < 0 ? -m_value : m_value;
} }
}; };
......
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