Fix safe_integer subtraction AGAIN

This commit is contained in:
Lee Clagett
2025-05-28 00:19:56 -04:00
parent cfac203297
commit 3b10aba624
+1 -1
View File
@@ -75,7 +75,7 @@ namespace lwsf { namespace internal
safe_integer& subtract(safe_integer rhs)
{
if ((0 < rhs.value_ && value_ < std::numeric_limits<T>::min() < rhs.value_) || (rhs.value_ < 0 && value_ > std::numeric_limits<T>::max() + rhs.value_))
if ((0 < rhs.value_ && value_ < std::numeric_limits<T>::min() + rhs.value_) || (rhs.value_ < 0 && value_ > std::numeric_limits<T>::max() + rhs.value_))
throw std::underflow_error{"safe_integer underflow in subtraction"};
value_ -= rhs.value_;
return *this;