From ac7ddd0cefacddde6bd5bcc674e8618addb51ee4 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Mon, 16 Feb 2026 18:39:14 +0000 Subject: [PATCH] reverted change in Number Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> --- include/xrpl/basics/Number.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/include/xrpl/basics/Number.h b/include/xrpl/basics/Number.h index 46bb35541d..c269d27781 100644 --- a/include/xrpl/basics/Number.h +++ b/include/xrpl/basics/Number.h @@ -698,12 +698,8 @@ Number::normalizeToRange(T minMantissa, T maxMantissa) const XRPL_ASSERT_PARTS(!negative, "xrpl::Number::normalizeToRange", "Number is non-negative for unsigned range."); Number::normalize(negative, mantissa, exponent, minMantissa, maxMantissa); - // Cast mantissa to signed type first to avoid unsigned integer overflow - // when multiplying by negative sign - T signedMantissa = static_cast(mantissa); - if (negative) - signedMantissa = -signedMantissa; - return std::make_pair(signedMantissa, exponent); + auto const sign = negative ? -1 : 1; + return std::make_pair(static_cast(sign * mantissa), exponent); } inline constexpr Number