mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-23 07:10:53 +00:00
fix: Fix Number comparison operator for signed types
- Instead of completely removing the code, it is wrapped in an `if constexpr` sign check. That way, it's future proof in case the type of mantissa_ ever changes again. - Ironically, this partially reverts PR 7406.
This commit is contained in:
@@ -525,10 +525,13 @@ public:
|
||||
return !lneg;
|
||||
|
||||
// If equal signs and exponents, compare mantissas.
|
||||
if (lneg)
|
||||
if constexpr (std::is_unsigned_v<decltype(l.mantissa_)>)
|
||||
{
|
||||
// If negative, the operator is reversed.
|
||||
return l.mantissa_ > r.mantissa_;
|
||||
if (lneg)
|
||||
{
|
||||
// If negative, the operator is reversed.
|
||||
return l.mantissa_ < r.mantissa_;
|
||||
}
|
||||
}
|
||||
|
||||
return l.mantissa_ < r.mantissa_;
|
||||
|
||||
Reference in New Issue
Block a user