Fix OverflowSafeInt negation not handling INT64_MIN
See: https://github.com/OpenTTD/OpenTTD/issues/8284
This commit is contained in:
@@ -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.
|
||||||
|
|||||||
Reference in New Issue
Block a user