Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
354 changes: 273 additions & 81 deletions include/xrpl/basics/Number.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion include/xrpl/protocol/Protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ std::size_t constexpr maxMPTokenMetadataLength = 1024;

/** The maximum amount of MPTokenIssuance */
std::uint64_t constexpr maxMPTokenAmount = 0x7FFF'FFFF'FFFF'FFFFull;
static_assert(Number::maxRep >= maxMPTokenAmount);
static_assert(Number::largestMantissa >= maxMPTokenAmount);

/** The maximum length of Data payload */
std::size_t constexpr maxDataPayloadLength = 256;
Expand Down
4 changes: 4 additions & 0 deletions include/xrpl/protocol/STAmount.h
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,10 @@ STAmount::fromNumber(A const& a, Number const& number)
return STAmount{asset, intValue, 0, negative};
}

XRPL_ASSERT_PARTS(
working.signum() >= 0,
"ripple::STAmount::fromNumber",
"non-negative Number to normalize");
auto const [mantissa, exponent] =
working.normalizeToRange(cMinValue, cMaxValue);

Expand Down
2 changes: 1 addition & 1 deletion include/xrpl/protocol/SystemParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ systemName()
/** Number of drops in the genesis account. */
constexpr XRPAmount INITIAL_XRP{100'000'000'000 * DROPS_PER_XRP};
static_assert(INITIAL_XRP.drops() == 100'000'000'000'000'000);
static_assert(Number::maxRep >= INITIAL_XRP.drops());
static_assert(Number::largestMantissa >= INITIAL_XRP.drops());

/** Returns true if the amount does not exceed the initial XRP in existence. */
inline bool
Expand Down
Loading
Loading