diff --git a/src/ripple/basics/Number.h b/src/ripple/basics/Number.h index 58d903579b5..c308abec712 100644 --- a/src/ripple/basics/Number.h +++ b/src/ripple/basics/Number.h @@ -81,6 +81,13 @@ class Number Number& operator/=(Number const& x); + static constexpr Number + min() noexcept; + static constexpr Number + max() noexcept; + static constexpr Number + lowest() noexcept; + explicit operator XRPAmount() const; // round to nearest, even on tie explicit operator rep() const; // round to nearest, even on tie @@ -290,6 +297,24 @@ operator/(Number const& x, Number const& y) return z; } +inline constexpr Number +Number::min() noexcept +{ + return Number{minMantissa, minExponent, unchecked{}}; +} + +inline constexpr Number +Number::max() noexcept +{ + return Number{maxMantissa, maxExponent, unchecked{}}; +} + +inline constexpr Number +Number::lowest() noexcept +{ + return -Number{maxMantissa, maxExponent, unchecked{}}; +} + inline constexpr bool Number::isnormal() const noexcept { diff --git a/src/ripple/basics/impl/IOUAmount.cpp b/src/ripple/basics/impl/IOUAmount.cpp index f011af19c01..c9b52874abd 100644 --- a/src/ripple/basics/impl/IOUAmount.cpp +++ b/src/ripple/basics/impl/IOUAmount.cpp @@ -53,7 +53,7 @@ IOUAmount::normalize() if (*stNumberSwitchover) { - const Number v{mantissa_, exponent_}; + Number const v{mantissa_, exponent_}; mantissa_ = v.mantissa(); exponent_ = v.exponent(); if (exponent_ > maxExponent) diff --git a/src/ripple/protocol/Feature.h b/src/ripple/protocol/Feature.h index 6be2d4dfb68..78b5b152c87 100644 --- a/src/ripple/protocol/Feature.h +++ b/src/ripple/protocol/Feature.h @@ -340,12 +340,9 @@ extern uint256 const featureNonFungibleTokensV1_1; extern uint256 const fixTrustLinesToSelf; extern uint256 const fixRemoveNFTokenAutoTrustLine; extern uint256 const featureImmediateOfferKilled; -<<<<<<< HEAD extern uint256 const featureDisallowIncoming; extern uint256 const featureXRPFees; -======= extern uint256 const fixUniversalNumber; ->>>>>>> Use Number for IOUAmount and STAmount arithmetic } // namespace ripple