Fix OverflowSafeInt negation not handling INT64_MIN

See: https://github.com/OpenTTD/OpenTTD/issues/8284
This commit is contained in:
Jonathan G Rennison
2020-10-02 17:50:20 +01:00
parent 52c433d9a4
commit 609f37cef9

View File

@@ -36,7 +36,7 @@ public:
inline OverflowSafeInt& operator = (const OverflowSafeInt& other) { this->m_value = other.m_value; return *this; } inline OverflowSafeInt& operator = (const OverflowSafeInt& other) { this->m_value = other.m_value; return *this; }
inline OverflowSafeInt operator - () const { return OverflowSafeInt(-this->m_value); } inline OverflowSafeInt operator - () const { return OverflowSafeInt(this->m_value == T_MIN ? T_MAX : -this->m_value); }
/** /**
* Safe implementation of addition. * Safe implementation of addition.