diff --git a/src/lib/mathlib/math/Functions.hpp b/src/lib/mathlib/math/Functions.hpp index 486ea52b6e..f3e715f0e8 100644 --- a/src/lib/mathlib/math/Functions.hpp +++ b/src/lib/mathlib/math/Functions.hpp @@ -227,7 +227,14 @@ constexpr T negate(T value) template<> constexpr int16_t negate(int16_t value) { - return (value == INT16_MIN) ? INT16_MAX : -value; + if (value == INT16_MAX) { + return INT16_MIN; + + } else if (value == INT16_MIN) { + return INT16_MAX; + } + + return -value; } inline bool isFinite(const float &value)