From 63f1a40b7784eb5fb3edfb9d9bd77d1f42f93231 Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Tue, 9 Jun 2026 17:06:27 -0400 Subject: [PATCH] Clean up the "New" names --- include/xrpl/basics/Number.h | 12 ++++++------ src/libxrpl/basics/Number.cpp | 18 +++++++++--------- src/libxrpl/protocol/Rules.cpp | 2 +- src/test/basics/Number_test.cpp | 8 ++++---- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/include/xrpl/basics/Number.h b/include/xrpl/basics/Number.h index fed79b78fe..3ecfa64a02 100644 --- a/include/xrpl/basics/Number.h +++ b/include/xrpl/basics/Number.h @@ -132,14 +132,14 @@ struct MantissaRange final LargeLegacy, // Large3_2_0 can be removed when fixCleanup3_3_0 is retired Large3_2_0, - LargeNew, // TODO: Convert this back to Large after conversion is done + Large, }; // This entire enum can be removed when fixCleanup3_2_0 is retired enum class CuspRoundingFix : std::uint8_t { Disabled = 0, Enabled3_2_0 = 1, - EnabledNew = 2, // TODO: Convert this back to Enabled after conversion is done + Enabled = 2, }; explicit constexpr MantissaRange(MantissaScale sc) : scale(sc) @@ -168,7 +168,7 @@ private: return 15; case MantissaScale::LargeLegacy: case MantissaScale::Large3_2_0: - case MantissaScale::LargeNew: + case MantissaScale::Large: return 18; // LCOV_EXCL_START default: @@ -199,8 +199,8 @@ private: return CuspRoundingFix::Disabled; case MantissaScale::Large3_2_0: return CuspRoundingFix::Enabled3_2_0; - case MantissaScale::LargeNew: - return CuspRoundingFix::EnabledNew; + case MantissaScale::Large: + return CuspRoundingFix::Enabled; default: // If called in a constexpr context, this throw assures that the build fails if an // invalid scale is used. @@ -885,7 +885,7 @@ to_string(MantissaRange::MantissaScale const& scale) return "LargeLegacy"; case MantissaRange::MantissaScale::Large3_2_0: return "Large320"; - case MantissaRange::MantissaScale::LargeNew: + case MantissaRange::MantissaScale::Large: return "Large"; default: throw std::runtime_error("Bad scale"); diff --git a/src/libxrpl/basics/Number.cpp b/src/libxrpl/basics/Number.cpp index 8253e6c6ee..234ee4e40c 100644 --- a/src/libxrpl/basics/Number.cpp +++ b/src/libxrpl/basics/Number.cpp @@ -31,7 +31,7 @@ namespace xrpl { thread_local Number::RoundingMode Number::mode = Number::RoundingMode::ToNearest; thread_local std::reference_wrapper Number::kRange = - MantissaRange::getMantissaRange(MantissaRange::MantissaScale::LargeNew); + MantissaRange::getMantissaRange(MantissaRange::MantissaScale::Large); std::set const& MantissaRange::getAllScales() @@ -40,7 +40,7 @@ MantissaRange::getAllScales() MantissaRange::MantissaScale::Small, MantissaRange::MantissaScale::LargeLegacy, MantissaRange::MantissaScale::Large3_2_0, - MantissaRange::MantissaScale::LargeNew, + MantissaRange::MantissaScale::Large, }; return kScales; } @@ -92,14 +92,14 @@ MantissaRange::getRanges() } { [[maybe_unused]] - constexpr static MantissaRange kRange{MantissaRange::MantissaScale::LargeNew}; + constexpr static MantissaRange kRange{MantissaRange::MantissaScale::Large}; static_assert(isPowerOfTen(kRange.min)); static_assert(kRange.min == 1'000'000'000'000'000'000ULL); static_assert(kRange.max == rep(9'999'999'999'999'999'999ULL)); static_assert(kRange.log == 18); static_assert(kRange.min < Number::kMaxRep); static_assert(kRange.max > Number::kMaxRep); - static_assert(kRange.cuspRoundingFix == CuspRoundingFix::EnabledNew); + static_assert(kRange.cuspRoundingFix == CuspRoundingFix::Enabled); } return map; }(); @@ -237,7 +237,7 @@ public: doDropDigit(T& mantissa, int& exponent) noexcept; enum class Round { - // The result is exact. No rounding is needed. Only used if cuspRoundingFix is EnabledNew. + // The result is exact. No rounding is needed. Only used if cuspRoundingFix is Enabled. Exact = -2, // Round down. Since we use integer math, that usually means no change is needed. // Exceptions are for when the result is between kMaxRap and kMaxRepUp (round to kMaxRep), @@ -247,7 +247,7 @@ public: // The result was exactly half-way between two integers. This will round to even. Even = 0, // Round up. Always adds 1 (or subtracts 1 in some cases if cuspRoundingFix is not - // EnabledNew) + // Enabled) Up = 1, }; @@ -363,7 +363,7 @@ Number::Guard::round() const noexcept { auto mode = Number::getround(); - if (cuspRoundingFix >= MantissaRange::CuspRoundingFix::EnabledNew && empty()) + if (cuspRoundingFix >= MantissaRange::CuspRoundingFix::Enabled && empty()) { // No remainder return Round::Exact; @@ -482,7 +482,7 @@ void Number::Guard::doRoundDown(bool& negative, T& mantissa, int& exponent) { auto r = round(); - if (cuspRoundingFix >= MantissaRange::CuspRoundingFix::EnabledNew) + if (cuspRoundingFix >= MantissaRange::CuspRoundingFix::Enabled) { // If there was any remainder, subtract 1 from the result. This is sufficient to get the // best rounding. @@ -814,7 +814,7 @@ Number::operator+=(Number const& y) xe = ye; xn = yn; } - if (cuspRoundingFix >= MantissaRange::CuspRoundingFix::EnabledNew) + if (cuspRoundingFix >= MantissaRange::CuspRoundingFix::Enabled) { // Grow xm/xe and pull digits out of the Guard until it's a little bit larger than // maxMantissa, so that normalize will have enough information to make an accurate diff --git a/src/libxrpl/protocol/Rules.cpp b/src/libxrpl/protocol/Rules.cpp index 06f50423b8..c7e9431f81 100644 --- a/src/libxrpl/protocol/Rules.cpp +++ b/src/libxrpl/protocol/Rules.cpp @@ -58,7 +58,7 @@ setCurrentTransactionRules(std::optional r) { if (enableCuspRounding3_3_0) { - return MantissaRange::MantissaScale::LargeNew; + return MantissaRange::MantissaScale::Large; } if (enableCuspRounding3_2_0) { diff --git a/src/test/basics/Number_test.cpp b/src/test/basics/Number_test.cpp index 24c515af1c..7121948d69 100644 --- a/src/test/basics/Number_test.cpp +++ b/src/test/basics/Number_test.cpp @@ -1813,7 +1813,7 @@ public: switch (scale) { case MantissaRange::MantissaScale::Large3_2_0: - case MantissaRange::MantissaScale::LargeNew: + case MantissaRange::MantissaScale::Large: BEAST_EXPECT(signedDifference >= 0); BEAST_EXPECT(signedDifference < pow10(product.exponent())); BEAST_EXPECT( @@ -1896,7 +1896,7 @@ public: switch (scale) { case MantissaRange::MantissaScale::Large3_2_0: - case MantissaRange::MantissaScale::LargeNew: + case MantissaRange::MantissaScale::Large: BEAST_EXPECT(stored >= exact); BEAST_EXPECT(diff < pow10(quotient.exponent())); break; @@ -1947,7 +1947,7 @@ public: switch (scale) { case MantissaRange::MantissaScale::Large3_2_0: - case MantissaRange::MantissaScale::LargeNew: + case MantissaRange::MantissaScale::Large: BEAST_EXPECT(stored <= exact); BEAST_EXPECT(diff > -pow10(quotient.exponent())); break; @@ -2005,7 +2005,7 @@ public: switch (scale) { case MantissaRange::MantissaScale::Large3_2_0: - case MantissaRange::MantissaScale::LargeNew: + case MantissaRange::MantissaScale::Large: BEAST_EXPECT(stored >= exact); BEAST_EXPECT(diff < pow10(quotient.exponent())); break;