mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-31 11:00:23 +00:00
Remove using namespace beast in base_uint.h
This commit is contained in:
@@ -427,7 +427,7 @@ Ledger::succ (uint256 const& key,
|
||||
std::shared_ptr<SLE const>
|
||||
Ledger::read (Keylet const& k) const
|
||||
{
|
||||
if (k.key == zero)
|
||||
if (k.key == beast::zero)
|
||||
{
|
||||
assert(false);
|
||||
return nullptr;
|
||||
|
||||
@@ -285,7 +285,7 @@ private:
|
||||
ledger->info().hash, ledger->info().seq,
|
||||
InboundLedger::Reason::GENERIC);
|
||||
}
|
||||
return hash ? *hash : zero; // kludge
|
||||
return hash ? *hash : beast::zero; // kludge
|
||||
}
|
||||
|
||||
/** Process a single ledger
|
||||
|
||||
@@ -1027,7 +1027,7 @@ LedgerMaster::findNewLedgersToPublish ()
|
||||
// VFALCO TODO Restructure this code so that zero is not
|
||||
// used.
|
||||
if (! hash)
|
||||
hash = zero; // kludge
|
||||
hash = beast::zero; // kludge
|
||||
if (seq == valSeq)
|
||||
{
|
||||
// We need to publish the ledger we just fully validated
|
||||
|
||||
@@ -99,7 +99,7 @@ void
|
||||
TransactionMaster::canonicalize(std::shared_ptr<Transaction>* pTransaction)
|
||||
{
|
||||
uint256 const tid = (*pTransaction)->getID();
|
||||
if (tid != zero)
|
||||
if (tid != beast::zero)
|
||||
{
|
||||
auto txn = *pTransaction;
|
||||
// VFALCO NOTE canonicalize can change the value of txn!
|
||||
|
||||
@@ -102,8 +102,8 @@ CanonicalTXSet::prune(AccountID const& account,
|
||||
{
|
||||
auto effectiveAccount = accountKey (account);
|
||||
|
||||
Key keyLow(effectiveAccount, seq, zero);
|
||||
Key keyHigh(effectiveAccount, seq+1, zero);
|
||||
Key keyLow(effectiveAccount, seq, beast::zero);
|
||||
Key keyHigh(effectiveAccount, seq+1, beast::zero);
|
||||
|
||||
auto range = boost::make_iterator_range(
|
||||
mMap.lower_bound(keyLow),
|
||||
|
||||
@@ -3076,7 +3076,7 @@ void NetworkOPsImp::getBookPage (
|
||||
uOfferOwnerID, book.out.currency,
|
||||
book.out.account, fhZERO_IF_FROZEN, viewJ);
|
||||
|
||||
if (saOwnerFunds < zero)
|
||||
if (saOwnerFunds < beast::zero)
|
||||
{
|
||||
// Treat negative funds as zero.
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ hash_set<Currency> accountSourceCurrencies (
|
||||
auto& saBalance = rspEntry->getBalance ();
|
||||
|
||||
// Filter out non
|
||||
if (saBalance > zero
|
||||
if (saBalance > beast::zero
|
||||
// Have IOUs to send.
|
||||
|| (rspEntry->getLimitPeer ()
|
||||
// Peer extends credit.
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
|
||||
bool initialize (Book const& book, ApplyView& view)
|
||||
{
|
||||
if (current != zero)
|
||||
if (current != beast::zero)
|
||||
return false;
|
||||
|
||||
current.copyFrom (getBookBase (book));
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
advanceNeeded = false;
|
||||
restartNeeded = false;
|
||||
|
||||
if (current == zero)
|
||||
if (current == beast::zero)
|
||||
return END_ADVANCE;
|
||||
|
||||
ledgerEntry = view.peek (keylet::page(current));
|
||||
|
||||
@@ -168,7 +168,7 @@ bool PathRequest::isValid (std::shared_ptr<RippleLineCache> const& crCache)
|
||||
if (! raSrcAccount || ! raDstAccount)
|
||||
return false;
|
||||
|
||||
if (! convert_all_ && (saSendMax || saDstAmount <= zero))
|
||||
if (! convert_all_ && (saSendMax || saDstAmount <= beast::zero))
|
||||
{
|
||||
// If send max specified, dst amt must be -1.
|
||||
jvStatus = rpcError(rpcDST_AMT_MALFORMED);
|
||||
@@ -316,7 +316,7 @@ int PathRequest::parseJson (Json::Value const& jvParams)
|
||||
if ((saDstAmount.getCurrency ().isZero () &&
|
||||
saDstAmount.getIssuer ().isNonZero ()) ||
|
||||
(saDstAmount.getCurrency () == badCurrency ()) ||
|
||||
(! convert_all_ && saDstAmount <= zero))
|
||||
(! convert_all_ && saDstAmount <= beast::zero))
|
||||
{
|
||||
jvStatus = rpcError (rpcDST_AMT_MALFORMED);
|
||||
return PFR_PJ_INVALID;
|
||||
@@ -337,7 +337,7 @@ int PathRequest::parseJson (Json::Value const& jvParams)
|
||||
(saSendMax->getCurrency().isZero() &&
|
||||
saSendMax->getIssuer().isNonZero()) ||
|
||||
(saSendMax->getCurrency() == badCurrency()) ||
|
||||
(*saSendMax <= zero &&
|
||||
(*saSendMax <= beast::zero &&
|
||||
*saSendMax != STAmount(saSendMax->issue(), 1u, 0, true)))
|
||||
{
|
||||
jvStatus = rpcError(rpcSENDMAX_MALFORMED);
|
||||
|
||||
@@ -52,7 +52,7 @@ void PathState::reset(STAmount const& in, STAmount const& out)
|
||||
saInAct = in;
|
||||
saOutAct = out;
|
||||
|
||||
if (inReq() > zero && inAct() >= inReq())
|
||||
if (inReq() > beast::zero && inAct() >= inReq())
|
||||
{
|
||||
JLOG (j_.warn())
|
||||
<< "rippleCalc: DONE:"
|
||||
@@ -60,7 +60,7 @@ void PathState::reset(STAmount const& in, STAmount const& out)
|
||||
<< " inReq()=" << inReq();
|
||||
}
|
||||
|
||||
assert (inReq() < zero || inAct() < inReq());
|
||||
assert (inReq() < beast::zero || inAct() < inReq());
|
||||
// Error if done.
|
||||
|
||||
if (outAct() >= outReq())
|
||||
@@ -310,7 +310,7 @@ TER PathState::pushNode (
|
||||
else if ((sleBck->getFieldU32 (sfFlags) & lsfRequireAuth) &&
|
||||
!(sleRippleState->getFieldU32 (sfFlags) &
|
||||
(bHigh ? lsfHighAuth : lsfLowAuth)) &&
|
||||
sleRippleState->getFieldAmount(sfBalance) == zero)
|
||||
sleRippleState->getFieldAmount(sfBalance) == beast::zero)
|
||||
{
|
||||
JLOG (j_.warn())
|
||||
<< "pushNode: delay: can't receive IOUs from "
|
||||
@@ -326,7 +326,7 @@ TER PathState::pushNode (
|
||||
node.issue_.currency);
|
||||
STAmount saLimit;
|
||||
|
||||
if (saOwed <= zero)
|
||||
if (saOwed <= beast::zero)
|
||||
{
|
||||
saLimit = creditLimit (view(),
|
||||
node.account_,
|
||||
|
||||
@@ -172,7 +172,7 @@ Pathfinder::Pathfinder (
|
||||
|
||||
bool Pathfinder::findPaths (int searchLevel)
|
||||
{
|
||||
if (mDstAmount == zero)
|
||||
if (mDstAmount == beast::zero)
|
||||
{
|
||||
// No need to send zero money.
|
||||
JLOG (j_.debug()) << "Destination amount was zero.";
|
||||
@@ -665,7 +665,7 @@ Pathfinder::getBestPaths (
|
||||
}
|
||||
}
|
||||
|
||||
if (remaining > zero)
|
||||
if (remaining > beast::zero)
|
||||
{
|
||||
assert (fullLiquidityPath.empty ());
|
||||
JLOG (j_.info()) <<
|
||||
@@ -726,7 +726,7 @@ int Pathfinder::getPathsOut (
|
||||
if (currency != rspEntry->getLimit ().getCurrency ())
|
||||
{
|
||||
}
|
||||
else if (rspEntry->getBalance () <= zero &&
|
||||
else if (rspEntry->getBalance () <= beast::zero &&
|
||||
(!rspEntry->getLimitPeer ()
|
||||
|| -rspEntry->getBalance () >= rspEntry->getLimitPeer ()
|
||||
|| (bAuthRequired && !rspEntry->getAuth ())))
|
||||
@@ -969,7 +969,7 @@ void Pathfinder::addLink (
|
||||
!currentPath.hasSeen (acct, uEndCurrency, acct))
|
||||
{
|
||||
// path is for correct currency and has not been seen
|
||||
if (rs->getBalance () <= zero
|
||||
if (rs->getBalance () <= beast::zero
|
||||
&& (!rs->getLimitPeer ()
|
||||
|| -rs->getBalance () >= rs->getLimitPeer ()
|
||||
|| (bRequireAuth && !rs->getAuth ())))
|
||||
|
||||
@@ -381,7 +381,7 @@ TER RippleCalc::rippleCalculate (detail::FlowDebugInfo* flowDebugInfo)
|
||||
|
||||
++iDry;
|
||||
}
|
||||
else if (pathState->outPass() == zero)
|
||||
else if (pathState->outPass() == beast::zero)
|
||||
{
|
||||
// Path is not dry, but moved no funds
|
||||
// This should never happen. Consider the path dry
|
||||
|
||||
@@ -27,8 +27,8 @@ namespace path {
|
||||
TER PathCursor::advanceNode (STAmount const& amount, bool reverse, bool callerHasLiquidity) const
|
||||
{
|
||||
bool const multi = fix1141 (view ().info ().parentCloseTime)
|
||||
? (multiQuality_ || (!callerHasLiquidity && amount == zero))
|
||||
: (multiQuality_ || amount == zero);
|
||||
? (multiQuality_ || (!callerHasLiquidity && amount == beast::zero))
|
||||
: (multiQuality_ || amount == beast::zero);
|
||||
|
||||
// If the multiQuality_ is unchanged, use the PathCursor we're using now.
|
||||
if (multi == multiQuality_)
|
||||
@@ -224,7 +224,7 @@ TER PathCursor::advanceNode (bool const bReverse) const
|
||||
continue;
|
||||
}
|
||||
|
||||
if (node().saTakerPays <= zero || node().saTakerGets <= zero)
|
||||
if (node().saTakerPays <= beast::zero || node().saTakerGets <= beast::zero)
|
||||
{
|
||||
// Offer has bad amounts. Offers should never have a bad
|
||||
// amounts.
|
||||
@@ -336,7 +336,7 @@ TER PathCursor::advanceNode (bool const bReverse) const
|
||||
fhZERO_IF_FROZEN, viewJ);
|
||||
// Funds held.
|
||||
|
||||
if (node().saOfferFunds <= zero)
|
||||
if (node().saOfferFunds <= beast::zero)
|
||||
{
|
||||
// Offer is unfunded.
|
||||
JLOG (j_.trace())
|
||||
|
||||
@@ -112,7 +112,7 @@ TER PathCursor::deliverNodeForward (
|
||||
saInFunded, xferRate, true);
|
||||
auto saInRemaining = saInReq - saInAct - saInFees;
|
||||
|
||||
if (saInRemaining < zero)
|
||||
if (saInRemaining < beast::zero)
|
||||
saInRemaining.clear();
|
||||
|
||||
// In limited by remaining.
|
||||
@@ -153,7 +153,7 @@ TER PathCursor::deliverNodeForward (
|
||||
<< " saOutPassMax=" << saOutPassMax;
|
||||
|
||||
// FIXME: We remove an offer if WE didn't want anything out of it?
|
||||
if (!node().saTakerPays || saInSum <= zero)
|
||||
if (!node().saTakerPays || saInSum <= beast::zero)
|
||||
{
|
||||
JLOG (j_.debug())
|
||||
<< "deliverNodeForward: Microscopic offer unfunded.";
|
||||
@@ -223,7 +223,7 @@ TER PathCursor::deliverNodeForward (
|
||||
saOutPassMax, // --> Amount available.
|
||||
saOutPassAct, // <-- Amount delivered.
|
||||
saOutPassFees, // <-- Fees charged.
|
||||
saInAct > zero);
|
||||
saInAct > beast::zero);
|
||||
|
||||
if (resultCode != tesSUCCESS)
|
||||
break;
|
||||
@@ -307,7 +307,7 @@ TER PathCursor::deliverNodeForward (
|
||||
STAmount saTakerGetsNew = node().saTakerGets - saOutPassAct;
|
||||
STAmount saTakerPaysNew = node().saTakerPays - saInPassAct;
|
||||
|
||||
if (saTakerPaysNew < zero || saTakerGetsNew < zero)
|
||||
if (saTakerPaysNew < beast::zero || saTakerGetsNew < beast::zero)
|
||||
{
|
||||
JLOG (j_.warn())
|
||||
<< "deliverNodeForward: NEGATIVE:"
|
||||
@@ -323,7 +323,7 @@ TER PathCursor::deliverNodeForward (
|
||||
|
||||
view().update (node().sleOffer);
|
||||
|
||||
if (saOutPassAct == saOutFunded || saTakerGetsNew == zero)
|
||||
if (saOutPassAct == saOutFunded || saTakerGetsNew == beast::zero)
|
||||
{
|
||||
// Offer became unfunded.
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ TER PathCursor::deliverNodeReverseImpl (
|
||||
<< " saOutReq=" << saOutReq
|
||||
<< " saPrvDlvReq=" << previousNode().saRevDeliver;
|
||||
|
||||
assert (saOutReq != zero);
|
||||
assert (saOutReq != beast::zero);
|
||||
|
||||
int loopCount = 0;
|
||||
auto viewJ = rippleCalc_.logs_.journal ("View");
|
||||
@@ -244,13 +244,13 @@ TER PathCursor::deliverNodeReverseImpl (
|
||||
node().offerOwnerAccount_,
|
||||
saInPassReq,
|
||||
saInPassAct,
|
||||
saOutAct > zero);
|
||||
saOutAct > beast::zero);
|
||||
|
||||
if (fix1141(view().info().parentCloseTime))
|
||||
{
|
||||
// The recursive call is dry this time, but we have liquidity
|
||||
// from previous calls
|
||||
if (resultCode == tecPATH_DRY && saOutAct > zero)
|
||||
if (resultCode == tecPATH_DRY && saOutAct > beast::zero)
|
||||
{
|
||||
resultCode = tesSUCCESS;
|
||||
break;
|
||||
@@ -305,7 +305,7 @@ TER PathCursor::deliverNodeReverseImpl (
|
||||
STAmount saTakerGetsNew = node().saTakerGets - saOutPassAct;
|
||||
STAmount saTakerPaysNew = node().saTakerPays - saInPassAct;
|
||||
|
||||
if (saTakerPaysNew < zero || saTakerGetsNew < zero)
|
||||
if (saTakerPaysNew < beast::zero || saTakerGetsNew < beast::zero)
|
||||
{
|
||||
JLOG (j_.warn())
|
||||
<< "deliverNodeReverse: NEGATIVE:"
|
||||
|
||||
@@ -30,7 +30,7 @@ TER PathCursor::forwardLiquidity () const
|
||||
return forwardLiquidityForAccount ();
|
||||
|
||||
// Otherwise, node is an offer.
|
||||
if (previousNode().account_ == zero)
|
||||
if (previousNode().account_ == beast::zero)
|
||||
return tesSUCCESS;
|
||||
|
||||
// Previous is an account node, resolve its deliver.
|
||||
|
||||
@@ -104,7 +104,7 @@ TER PathCursor::forwardLiquidityForAccount () const
|
||||
// available.
|
||||
node().saFwdRedeem = node().saRevRedeem;
|
||||
|
||||
if (pathState_.inReq() >= zero)
|
||||
if (pathState_.inReq() >= beast::zero)
|
||||
{
|
||||
// Limit by send max.
|
||||
node().saFwdRedeem = std::min (
|
||||
@@ -117,7 +117,7 @@ TER PathCursor::forwardLiquidityForAccount () const
|
||||
// Fully redeemed.
|
||||
? node().saRevIssue : STAmount (node().saRevIssue);
|
||||
|
||||
if (node().saFwdIssue && pathState_.inReq() >= zero)
|
||||
if (node().saFwdIssue && pathState_.inReq() >= beast::zero)
|
||||
{
|
||||
// Limit by send max.
|
||||
node().saFwdIssue = std::min (
|
||||
@@ -343,7 +343,7 @@ TER PathCursor::forwardLiquidityForAccount () const
|
||||
node().saFwdDeliver = node().saRevDeliver;
|
||||
|
||||
// If limited, then limit by send max and available.
|
||||
if (pathState_.inReq() >= zero)
|
||||
if (pathState_.inReq() >= beast::zero)
|
||||
{
|
||||
// Limit by send max.
|
||||
node().saFwdDeliver = std::min (
|
||||
|
||||
@@ -118,13 +118,13 @@ TER PathCursor::reverseLiquidityForAccount () const
|
||||
|
||||
// Requests are computed to be the maximum flow possible.
|
||||
// Previous can redeem the owed IOUs it holds.
|
||||
const STAmount saPrvRedeemReq = (saPrvOwed > zero)
|
||||
const STAmount saPrvRedeemReq = (saPrvOwed > beast::zero)
|
||||
? saPrvOwed
|
||||
: STAmount (saPrvOwed.issue ());
|
||||
|
||||
// Previous can issue up to limit minus whatever portion of limit already
|
||||
// used (not including redeemable amount) - another "maximum flow".
|
||||
const STAmount saPrvIssueReq = (saPrvOwed < zero)
|
||||
const STAmount saPrvIssueReq = (saPrvOwed < beast::zero)
|
||||
? saPrvLimit + saPrvOwed : saPrvLimit;
|
||||
|
||||
// Precompute these values in case we have an order book.
|
||||
@@ -158,7 +158,7 @@ TER PathCursor::reverseLiquidityForAccount () const
|
||||
// Current redeem req can't be more than IOUs on hand.
|
||||
assert (!node().saRevRedeem || -saNxtOwed >= node().saRevRedeem);
|
||||
assert (!node().saRevIssue // If not issuing, fine.
|
||||
|| saNxtOwed >= zero
|
||||
|| saNxtOwed >= beast::zero
|
||||
// saNxtOwed >= 0: Sender not holding next IOUs, saNxtOwed < 0:
|
||||
// Sender holding next IOUs.
|
||||
|| -saNxtOwed == node().saRevRedeem);
|
||||
@@ -395,7 +395,7 @@ TER PathCursor::reverseLiquidityForAccount () const
|
||||
//
|
||||
// TODO(tom): Make sure deliver was cleared, or check actual is zero.
|
||||
// redeem -> deliver/issue.
|
||||
if (saPrvOwed > zero // Previous has IOUs to redeem.
|
||||
if (saPrvOwed > beast::zero // Previous has IOUs to redeem.
|
||||
&& node().saRevDeliver) // Need some issued.
|
||||
{
|
||||
// Rate : 1.0 : transfer_rate
|
||||
@@ -459,7 +459,7 @@ TER PathCursor::reverseLiquidityForAccount () const
|
||||
<< " saOutAct:" << pathState_.outAct()
|
||||
<< " saOutReq:" << pathState_.outReq();
|
||||
|
||||
if (saCurWantedReq <= zero)
|
||||
if (saCurWantedReq <= beast::zero)
|
||||
{
|
||||
assert(false);
|
||||
JLOG (j_.fatal()) << "CurWantReq was not positive";
|
||||
|
||||
@@ -65,15 +65,15 @@ void rippleLiquidity (
|
||||
<< " saPrvAct=" << saPrvAct
|
||||
<< " saCurAct=" << saCurAct;
|
||||
|
||||
// saCurAct was once zero in a production server.
|
||||
assert (saCurReq != zero);
|
||||
assert (saCurReq > zero);
|
||||
// saCurAct was once beast::zero in a production server.
|
||||
assert (saCurReq != beast::zero);
|
||||
assert (saCurReq > beast::zero);
|
||||
|
||||
assert (saPrvReq.getCurrency () == saCurReq.getCurrency ());
|
||||
assert (saPrvReq.getCurrency () == saPrvAct.getCurrency ());
|
||||
assert (saPrvReq.getIssuer () == saPrvAct.getIssuer ());
|
||||
|
||||
const bool bPrvUnlimited = (saPrvReq < zero); // -1 means unlimited.
|
||||
const bool bPrvUnlimited = (saPrvReq < beast::zero); // -1 means unlimited.
|
||||
|
||||
// Unlimited stays unlimited - don't do calculations.
|
||||
|
||||
@@ -90,7 +90,7 @@ void rippleLiquidity (
|
||||
<< " saCur=" << saCur;
|
||||
|
||||
// If nothing can flow, we might as well not do any work.
|
||||
if (saPrv == zero || saCur == zero)
|
||||
if (saPrv == beast::zero || saCur == beast::zero)
|
||||
return;
|
||||
|
||||
if (qualityIn >= qualityOut)
|
||||
|
||||
@@ -413,7 +413,7 @@ DirectIPaymentStep::check (
|
||||
|
||||
if (((*sleSrc)[sfFlags] & lsfRequireAuth) &&
|
||||
!((*sleLine)[sfFlags] & authField) &&
|
||||
(*sleLine)[sfBalance] == zero)
|
||||
(*sleLine)[sfBalance] == beast::zero)
|
||||
{
|
||||
JLOG (j_.warn())
|
||||
<< "DirectStepI: can't receive IOUs from issuer without auth."
|
||||
@@ -437,7 +437,7 @@ DirectIPaymentStep::check (
|
||||
|
||||
{
|
||||
auto const owed = creditBalance (ctx.view, dst_, src_, currency_);
|
||||
if (owed <= zero)
|
||||
if (owed <= beast::zero)
|
||||
{
|
||||
auto const limit = creditLimit (ctx.view, dst_, src_, currency_);
|
||||
if (-owed >= limit)
|
||||
|
||||
@@ -635,7 +635,7 @@ flow (PaymentSandbox const& baseView,
|
||||
// we're handling a FillOrKill offer. In this case remainingIn must
|
||||
// be zero (all funds must be consumed) or else we kill the offer.
|
||||
assert (remainingIn);
|
||||
if (remainingIn && *remainingIn != zero)
|
||||
if (remainingIn && *remainingIn != beast::zero)
|
||||
return {tecPATH_PARTIAL,
|
||||
actualIn, actualOut, std::move(ofrsToRmOnFail)};
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ Change::preflight (PreflightContext const& ctx)
|
||||
return ret;
|
||||
|
||||
auto account = ctx.tx.getAccountID(sfAccount);
|
||||
if (account != zero)
|
||||
if (account != beast::zero)
|
||||
{
|
||||
JLOG(ctx.j.warn()) << "Change: Bad source id";
|
||||
return temBAD_SRC_ACCOUNT;
|
||||
@@ -99,7 +99,7 @@ void
|
||||
Change::preCompute()
|
||||
{
|
||||
account_ = ctx_.tx.getAccountID(sfAccount);
|
||||
assert(account_ == zero);
|
||||
assert(account_ == beast::zero);
|
||||
}
|
||||
|
||||
TER
|
||||
|
||||
@@ -97,7 +97,7 @@ CreateOffer::preflight (PreflightContext const& ctx)
|
||||
"Malformed offer: redundant (XRP for XRP)";
|
||||
return temBAD_OFFER;
|
||||
}
|
||||
if (saTakerPays <= zero || saTakerGets <= zero)
|
||||
if (saTakerPays <= beast::zero || saTakerGets <= beast::zero)
|
||||
{
|
||||
JLOG(j.debug()) <<
|
||||
"Malformed offer: bad amount";
|
||||
@@ -165,7 +165,7 @@ CreateOffer::preclaim(PreclaimContext const& ctx)
|
||||
return tecFROZEN;
|
||||
}
|
||||
else if (accountFunds(ctx.view, id, saTakerGets,
|
||||
fhZERO_IF_FROZEN, viewJ) <= zero)
|
||||
fhZERO_IF_FROZEN, viewJ) <= beast::zero)
|
||||
{
|
||||
JLOG(ctx.j.debug()) <<
|
||||
"delay: Offers must be at least partially funded.";
|
||||
@@ -285,7 +285,7 @@ CreateOffer::dry_offer (ApplyView& view, Offer const& offer)
|
||||
return true;
|
||||
auto const amount = accountFunds(view, offer.owner(),
|
||||
offer.amount().out, fhZERO_IF_FROZEN, ctx_.app.journal ("View"));
|
||||
return (amount <= zero);
|
||||
return (amount <= beast::zero);
|
||||
}
|
||||
|
||||
std::pair<bool, Quality>
|
||||
@@ -653,7 +653,7 @@ CreateOffer::flowCross (
|
||||
// below the reserve) so we check this case again.
|
||||
STAmount const inStartBalance = accountFunds (
|
||||
psb, account_, takerAmount.in, fhZERO_IF_FROZEN, j_);
|
||||
if (inStartBalance <= zero)
|
||||
if (inStartBalance <= beast::zero)
|
||||
{
|
||||
// The account balance can't cover even part of the offer.
|
||||
JLOG (j_.debug()) <<
|
||||
@@ -745,7 +745,7 @@ CreateOffer::flowCross (
|
||||
STAmount const takerInBalance = accountFunds (
|
||||
psb, account_, takerAmount.in, fhZERO_IF_FROZEN, j_);
|
||||
|
||||
if (takerInBalance <= zero)
|
||||
if (takerInBalance <= beast::zero)
|
||||
{
|
||||
// If offer crossing exhausted the account's funds don't
|
||||
// create the offer.
|
||||
@@ -776,7 +776,7 @@ CreateOffer::flowCross (
|
||||
|
||||
// It's possible that the divRound will cause our subtract
|
||||
// to go slightly negative. So limit afterCross.in to zero.
|
||||
if (afterCross.in < zero)
|
||||
if (afterCross.in < beast::zero)
|
||||
// We should verify that the difference *is* small, but
|
||||
// what is a good threshold to check?
|
||||
afterCross.in.clear();
|
||||
@@ -790,8 +790,8 @@ CreateOffer::flowCross (
|
||||
// remaining output. This too preserves the offer
|
||||
// Quality.
|
||||
afterCross.out -= result.actualAmountOut;
|
||||
assert (afterCross.out >= zero);
|
||||
if (afterCross.out < zero)
|
||||
assert (afterCross.out >= beast::zero);
|
||||
if (afterCross.out < beast::zero)
|
||||
afterCross.out.clear();
|
||||
afterCross.in = mulRound (afterCross.out,
|
||||
rate, takerAmount.in.issue(), true);
|
||||
@@ -913,6 +913,8 @@ CreateOffer::cross (
|
||||
Sandbox& sbCancel,
|
||||
Amounts const& takerAmount)
|
||||
{
|
||||
using beast::zero;
|
||||
|
||||
// There are features for Flow offer crossing and for comparing results
|
||||
// between Taker and Flow offer crossing. Turn those into bools.
|
||||
bool const useFlowCross { sb.rules().enabled (featureFlowCross) };
|
||||
@@ -1067,6 +1069,8 @@ CreateOffer::preCompute()
|
||||
std::pair<TER, bool>
|
||||
CreateOffer::applyGuts (Sandbox& sb, Sandbox& sbCancel)
|
||||
{
|
||||
using beast::zero;
|
||||
|
||||
std::uint32_t const uTxFlags = ctx_.tx.getFlags ();
|
||||
|
||||
bool const bPassive (uTxFlags & tfPassive);
|
||||
|
||||
@@ -97,9 +97,9 @@ public:
|
||||
bool
|
||||
fully_consumed () const
|
||||
{
|
||||
if (m_amounts.in <= zero)
|
||||
if (m_amounts.in <= beast::zero)
|
||||
return true;
|
||||
if (m_amounts.out <= zero)
|
||||
if (m_amounts.out <= beast::zero)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ TOfferStreamBase<TIn, TOut>::step ()
|
||||
offer_.issueOut (), fhZERO_IF_FROZEN, j_);
|
||||
|
||||
// Check for unfunded offer
|
||||
if (*ownerFunds_ <= zero)
|
||||
if (*ownerFunds_ <= beast::zero)
|
||||
{
|
||||
// If the owner's balance in the pristine view is the same,
|
||||
// we haven't modified the balance and therefore the
|
||||
|
||||
@@ -82,7 +82,7 @@ Payment::preflight (PreflightContext const& ctx)
|
||||
maxSourceAmount = STAmount (
|
||||
{ saDstAmount.getCurrency (), account },
|
||||
saDstAmount.mantissa(), saDstAmount.exponent (),
|
||||
saDstAmount < zero);
|
||||
saDstAmount < beast::zero);
|
||||
|
||||
auto const& uSrcCurrency = maxSourceAmount.getCurrency ();
|
||||
auto const& uDstCurrency = saDstAmount.getCurrency ();
|
||||
@@ -101,13 +101,13 @@ Payment::preflight (PreflightContext const& ctx)
|
||||
"Payment destination account not specified.";
|
||||
return temDST_NEEDED;
|
||||
}
|
||||
if (bMax && maxSourceAmount <= zero)
|
||||
if (bMax && maxSourceAmount <= beast::zero)
|
||||
{
|
||||
JLOG(j.trace()) << "Malformed transaction: " <<
|
||||
"bad max amount: " << maxSourceAmount.getFullText ();
|
||||
return temBAD_AMOUNT;
|
||||
}
|
||||
if (saDstAmount <= zero)
|
||||
if (saDstAmount <= beast::zero)
|
||||
{
|
||||
JLOG(j.trace()) << "Malformed transaction: "<<
|
||||
"bad dst amount: " << saDstAmount.getFullText ();
|
||||
@@ -175,7 +175,7 @@ Payment::preflight (PreflightContext const& ctx)
|
||||
}
|
||||
|
||||
auto const dMin = *deliverMin;
|
||||
if (!isLegalNet(dMin) || dMin <= zero)
|
||||
if (!isLegalNet(dMin) || dMin <= beast::zero)
|
||||
{
|
||||
JLOG(j.trace()) << "Malformed transaction: Invalid " <<
|
||||
jss::DeliverMin.c_str() << " amount. " <<
|
||||
@@ -320,7 +320,7 @@ Payment::doApply ()
|
||||
maxSourceAmount = STAmount (
|
||||
{saDstAmount.getCurrency (), account_},
|
||||
saDstAmount.mantissa(), saDstAmount.exponent (),
|
||||
saDstAmount < zero);
|
||||
saDstAmount < beast::zero);
|
||||
|
||||
JLOG(j_.trace()) <<
|
||||
"maxSourceAmount=" << maxSourceAmount.getFullText () <<
|
||||
|
||||
@@ -66,7 +66,7 @@ SetTrust::preflight (PreflightContext const& ctx)
|
||||
return temBAD_CURRENCY;
|
||||
}
|
||||
|
||||
if (saLimitAmount < zero)
|
||||
if (saLimitAmount < beast::zero)
|
||||
{
|
||||
JLOG(j.trace()) <<
|
||||
"Malformed transaction: Negative credit limit.";
|
||||
@@ -168,7 +168,7 @@ SetTrust::doApply ()
|
||||
// could use the extra XRP for their own purposes.
|
||||
|
||||
XRPAmount const reserveCreate ((uOwnerCount < 2)
|
||||
? XRPAmount (zero)
|
||||
? XRPAmount (beast::zero)
|
||||
: view().fees().accountReserve(uOwnerCount + 1));
|
||||
|
||||
std::uint32_t uQualityIn (bQualityIn ? ctx_.tx.getFieldU32 (sfQualityIn) : 0);
|
||||
@@ -317,7 +317,7 @@ SetTrust::doApply ()
|
||||
std::uint32_t const uFlagsIn (sleRippleState->getFieldU32 (sfFlags));
|
||||
std::uint32_t uFlagsOut (uFlagsIn);
|
||||
|
||||
if (bSetNoRipple && !bClearNoRipple && (bHigh ? saHighBalance : saLowBalance) >= zero)
|
||||
if (bSetNoRipple && !bClearNoRipple && (bHigh ? saHighBalance : saLowBalance) >= beast::zero)
|
||||
{
|
||||
uFlagsOut |= (bHigh ? lsfHighNoRipple : lsfLowNoRipple);
|
||||
}
|
||||
@@ -345,13 +345,13 @@ SetTrust::doApply ()
|
||||
bool const bLowReserveSet = uLowQualityIn || uLowQualityOut ||
|
||||
((uFlagsOut & lsfLowNoRipple) == 0) != bLowDefRipple ||
|
||||
(uFlagsOut & lsfLowFreeze) ||
|
||||
saLowLimit || saLowBalance > zero;
|
||||
saLowLimit || saLowBalance > beast::zero;
|
||||
bool const bLowReserveClear = !bLowReserveSet;
|
||||
|
||||
bool const bHighReserveSet = uHighQualityIn || uHighQualityOut ||
|
||||
((uFlagsOut & lsfHighNoRipple) == 0) != bHighDefRipple ||
|
||||
(uFlagsOut & lsfHighFreeze) ||
|
||||
saHighLimit || saHighBalance > zero;
|
||||
saHighLimit || saHighBalance > beast::zero;
|
||||
bool const bHighReserveClear = !bHighReserveSet;
|
||||
|
||||
bool const bDefault = bLowReserveClear && bHighReserveClear;
|
||||
|
||||
@@ -50,8 +50,8 @@ BasicTaker::BasicTaker (
|
||||
, cross_type_ (cross_type)
|
||||
, journal_ (journal)
|
||||
{
|
||||
assert (remaining_.in > zero);
|
||||
assert (remaining_.out > zero);
|
||||
assert (remaining_.in > beast::zero);
|
||||
assert (remaining_.out > beast::zero);
|
||||
|
||||
assert (m_rate_in.value != 0);
|
||||
assert (m_rate_out.value != 0);
|
||||
@@ -95,7 +95,7 @@ BasicTaker::effective_rate (
|
||||
bool
|
||||
BasicTaker::unfunded () const
|
||||
{
|
||||
if (get_funds (account(), remaining_.in) > zero)
|
||||
if (get_funds (account(), remaining_.in) > beast::zero)
|
||||
return false;
|
||||
|
||||
JLOG(journal_.debug()) << "Unfunded: taker is out of funds.";
|
||||
@@ -106,7 +106,7 @@ bool
|
||||
BasicTaker::done () const
|
||||
{
|
||||
// We are done if we have consumed all the input currency
|
||||
if (remaining_.in <= zero)
|
||||
if (remaining_.in <= beast::zero)
|
||||
{
|
||||
JLOG(journal_.debug()) << "Done: all the input currency has been consumed.";
|
||||
return true;
|
||||
@@ -114,7 +114,7 @@ BasicTaker::done () const
|
||||
|
||||
// We are done if using buy semantics and we received the
|
||||
// desired amount of output currency
|
||||
if (!sell_ && (remaining_.out <= zero))
|
||||
if (!sell_ && (remaining_.out <= beast::zero))
|
||||
{
|
||||
JLOG(journal_.debug()) << "Done: the desired amount has been received.";
|
||||
return true;
|
||||
@@ -143,14 +143,14 @@ BasicTaker::remaining_offer () const
|
||||
|
||||
if (sell_)
|
||||
{
|
||||
assert (remaining_.in > zero);
|
||||
assert (remaining_.in > beast::zero);
|
||||
|
||||
// We scale the output based on the remaining input:
|
||||
return Amounts (remaining_.in, divRound (
|
||||
remaining_.in, quality_.rate (), issue_out_, true));
|
||||
}
|
||||
|
||||
assert (remaining_.out > zero);
|
||||
assert (remaining_.out > beast::zero);
|
||||
|
||||
// We scale the input based on the remaining output:
|
||||
return Amounts (mulRound (
|
||||
@@ -398,7 +398,7 @@ BasicTaker::do_cross (Amounts offer, Quality quality, AccountID const& owner)
|
||||
remaining_.out -= result.order.out;
|
||||
remaining_.in -= result.order.in;
|
||||
|
||||
assert (remaining_.in >= zero);
|
||||
assert (remaining_.in >= beast::zero);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -545,10 +545,10 @@ Taker::Taker (CrossType cross_type, ApplyView& view,
|
||||
void
|
||||
Taker::consume_offer (Offer& offer, Amounts const& order)
|
||||
{
|
||||
if (order.in < zero)
|
||||
if (order.in < beast::zero)
|
||||
Throw<std::logic_error> ("flow with negative input.");
|
||||
|
||||
if (order.out < zero)
|
||||
if (order.out < beast::zero)
|
||||
Throw<std::logic_error> ("flow with negative output.");
|
||||
|
||||
JLOG(journal_.debug()) << "Consuming from offer " << offer;
|
||||
@@ -582,7 +582,7 @@ TER Taker::transferXRP (
|
||||
return tesSUCCESS;
|
||||
|
||||
// Transferring zero is equivalent to not doing a transfer
|
||||
if (amount == zero)
|
||||
if (amount == beast::zero)
|
||||
return tesSUCCESS;
|
||||
|
||||
return ripple::transferXRP (view_, from, to, amount, journal_);
|
||||
@@ -600,17 +600,17 @@ TER Taker::redeemIOU (
|
||||
return tesSUCCESS;
|
||||
|
||||
// Transferring zero is equivalent to not doing a transfer
|
||||
if (amount == zero)
|
||||
if (amount == beast::zero)
|
||||
return tesSUCCESS;
|
||||
|
||||
// If we are trying to redeem some amount, then the account
|
||||
// must have a credit balance.
|
||||
if (get_funds (account, amount) <= zero)
|
||||
if (get_funds (account, amount) <= beast::zero)
|
||||
Throw<std::logic_error> ("redeemIOU has no funds to redeem");
|
||||
|
||||
auto ret = ripple::redeemIOU (view_, account, amount, issue, journal_);
|
||||
|
||||
if (get_funds (account, amount) < zero)
|
||||
if (get_funds (account, amount) < beast::zero)
|
||||
Throw<std::logic_error> ("redeemIOU redeemed more funds than available");
|
||||
|
||||
return ret;
|
||||
@@ -628,7 +628,7 @@ TER Taker::issueIOU (
|
||||
return tesSUCCESS;
|
||||
|
||||
// Transferring zero is equivalent to not doing a transfer
|
||||
if (amount == zero)
|
||||
if (amount == beast::zero)
|
||||
return tesSUCCESS;
|
||||
|
||||
return ripple::issueIOU (view_, account, amount, issue, journal_);
|
||||
|
||||
@@ -80,6 +80,8 @@ protected:
|
||||
|
||||
bool sanity_check () const
|
||||
{
|
||||
using beast::zero;
|
||||
|
||||
if (isXRP (order.in) && isXRP (order.out))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ preflight1 (PreflightContext const& ctx)
|
||||
return ret;
|
||||
|
||||
auto const id = ctx.tx.getAccountID(sfAccount);
|
||||
if (id == zero)
|
||||
if (id == beast::zero)
|
||||
{
|
||||
JLOG(ctx.j.warn()) << "preflight1: bad account id";
|
||||
return temBAD_SRC_ACCOUNT;
|
||||
@@ -180,7 +180,7 @@ Transactor::checkFee (PreclaimContext const& ctx,
|
||||
return telINSUF_FEE_P;
|
||||
}
|
||||
|
||||
if (feePaid == zero)
|
||||
if (feePaid == beast::zero)
|
||||
return tesSUCCESS;
|
||||
|
||||
auto const id = ctx.tx.getAccountID(sfAccount);
|
||||
@@ -194,7 +194,7 @@ Transactor::checkFee (PreclaimContext const& ctx,
|
||||
" balance=" << to_string(balance) <<
|
||||
" paid=" << to_string(feePaid);
|
||||
|
||||
if ((balance > zero) && !ctx.view.open())
|
||||
if ((balance > beast::zero) && !ctx.view.open())
|
||||
{
|
||||
// Closed ledger, non-zero balance, less than fee
|
||||
return tecINSUFF_FEE;
|
||||
@@ -290,7 +290,7 @@ Transactor::setSeq ()
|
||||
void Transactor::preCompute ()
|
||||
{
|
||||
account_ = ctx_.tx.getAccountID(sfAccount);
|
||||
assert(account_ != zero);
|
||||
assert(account_ != beast::zero);
|
||||
}
|
||||
|
||||
TER Transactor::apply ()
|
||||
@@ -303,7 +303,7 @@ TER Transactor::apply ()
|
||||
|
||||
// sle must exist except for transactions
|
||||
// that allow zero account.
|
||||
assert(sle != nullptr || account_ == zero);
|
||||
assert(sle != nullptr || account_ == beast::zero);
|
||||
|
||||
if (sle)
|
||||
{
|
||||
@@ -576,7 +576,7 @@ Transactor::reset(XRPAmount fee)
|
||||
auto const balance = txnAcct->getFieldAmount (sfBalance).xrp ();
|
||||
|
||||
// balance should have already been checked in checkFee / preFlight.
|
||||
assert(balance != zero && (!view().open() || balance >= fee));
|
||||
assert(balance != beast::zero && (!view().open() || balance >= fee));
|
||||
|
||||
// We retry/reject the transaction if the account balance is zero or we're
|
||||
// applying against an open ledger and the balance is less than the fee
|
||||
@@ -705,14 +705,14 @@ Transactor::operator()()
|
||||
// The transactor and invariant checkers guarantee that this will
|
||||
// *never* trigger but if it, somehow, happens, don't allow a tx
|
||||
// that charges a negative fee.
|
||||
if (fee < zero)
|
||||
if (fee < beast::zero)
|
||||
Throw<std::logic_error> ("fee charged is negative!");
|
||||
|
||||
// Charge whatever fee they specified. The fee has already been
|
||||
// deducted from the balance of the account that issued the
|
||||
// transaction. We just need to account for it in the ledger
|
||||
// header.
|
||||
if (!view().open() && fee != zero)
|
||||
if (!view().open() && fee != beast::zero)
|
||||
ctx_.destroyXRP (fee);
|
||||
|
||||
// Once we call apply, we will no longer be able to look at view()
|
||||
|
||||
@@ -84,7 +84,7 @@ invoke_preclaim(PreclaimContext const& ctx)
|
||||
// list one, preflight will have already a flagged a failure.
|
||||
auto const id = ctx.tx.getAccountID(sfAccount);
|
||||
|
||||
if (id != zero)
|
||||
if (id != beast::zero)
|
||||
{
|
||||
TER result = T::checkSeq(ctx);
|
||||
|
||||
|
||||
@@ -35,9 +35,6 @@
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
|
||||
using beast::zero;
|
||||
using beast::Zero;
|
||||
|
||||
namespace ripple {
|
||||
|
||||
// This class stores its values internally in big-endian form
|
||||
@@ -392,7 +389,7 @@ public:
|
||||
return bytes;
|
||||
}
|
||||
|
||||
base_uint<Bits, Tag>& operator=(Zero)
|
||||
base_uint<Bits, Tag>& operator=(beast::Zero)
|
||||
{
|
||||
pn.fill(0);
|
||||
return *this;
|
||||
|
||||
@@ -85,12 +85,12 @@ struct LedgerInfo
|
||||
//
|
||||
|
||||
// Closed means "tx set already determined"
|
||||
uint256 hash = zero;
|
||||
uint256 txHash = zero;
|
||||
uint256 accountHash = zero;
|
||||
uint256 parentHash = zero;
|
||||
uint256 hash = beast::zero;
|
||||
uint256 txHash = beast::zero;
|
||||
uint256 accountHash = beast::zero;
|
||||
uint256 parentHash = beast::zero;
|
||||
|
||||
XRPAmount drops = zero;
|
||||
XRPAmount drops = beast::zero;
|
||||
|
||||
// If validated is false, it means "not yet validated."
|
||||
// Once validated is true, it will never be set false at a later time.
|
||||
|
||||
@@ -27,10 +27,10 @@ BookDirs::BookDirs(ReadView const& view, Book const& book)
|
||||
: view_(&view)
|
||||
, root_(keylet::page(getBookBase(book)).key)
|
||||
, next_quality_(getQualityNext(root_))
|
||||
, key_(view_->succ(root_, next_quality_).value_or(zero))
|
||||
, key_(view_->succ(root_, next_quality_).value_or(beast::zero))
|
||||
{
|
||||
assert(root_ != zero);
|
||||
if (key_ != zero)
|
||||
assert(root_ != beast::zero);
|
||||
if (key_ != beast::zero)
|
||||
{
|
||||
if (! cdirFirst(*view_, key_, sle_, entry_, index_,
|
||||
beast::Journal()))
|
||||
@@ -45,7 +45,7 @@ BookDirs::begin() const ->
|
||||
BookDirs::const_iterator
|
||||
{
|
||||
auto it = BookDirs::const_iterator(*view_, root_, key_);
|
||||
if (key_ != zero)
|
||||
if (key_ != beast::zero)
|
||||
{
|
||||
it.next_quality_ = next_quality_;
|
||||
it.sle_ = sle_;
|
||||
@@ -81,7 +81,7 @@ BookDirs::const_iterator::operator==
|
||||
BookDirs::const_iterator::reference
|
||||
BookDirs::const_iterator::operator*() const
|
||||
{
|
||||
assert(index_ != zero);
|
||||
assert(index_ != beast::zero);
|
||||
if (! cache_)
|
||||
cache_ = view_->read(keylet::offer(index_));
|
||||
return *cache_;
|
||||
@@ -90,6 +90,8 @@ BookDirs::const_iterator::operator*() const
|
||||
BookDirs::const_iterator&
|
||||
BookDirs::const_iterator::operator++()
|
||||
{
|
||||
using beast::zero;
|
||||
|
||||
assert(index_ != zero);
|
||||
if (! cdirNext(*view_, cur_key_, sle_, entry_, index_, j_))
|
||||
{
|
||||
@@ -115,7 +117,7 @@ BookDirs::const_iterator::operator++()
|
||||
BookDirs::const_iterator
|
||||
BookDirs::const_iterator::operator++(int)
|
||||
{
|
||||
assert(index_ != zero);
|
||||
assert(index_ != beast::zero);
|
||||
const_iterator tmp(*this);
|
||||
++(*this);
|
||||
return tmp;
|
||||
|
||||
@@ -109,6 +109,8 @@ static bool treatZeroOfferAsDeletion (CashSummary& result, bool isDelete,
|
||||
std::shared_ptr<SLE const> const& before,
|
||||
std::shared_ptr<SLE const> const& after)
|
||||
{
|
||||
using beast::zero;
|
||||
|
||||
if (!before)
|
||||
return false;
|
||||
|
||||
@@ -695,7 +697,7 @@ bool diffIsDust (STAmount const& v1, STAmount const& v2, std::uint8_t e10)
|
||||
{
|
||||
// If one value is positive and the other negative then there's something
|
||||
// odd afoot.
|
||||
if (v1 != zero && v2 != zero && (v1.negative() != v2.negative()))
|
||||
if (v1 != beast::zero && v2 != beast::zero && (v1.negative() != v2.negative()))
|
||||
return false;
|
||||
|
||||
// v1 and v2 must be the same Issue for their difference to make sense.
|
||||
@@ -766,7 +768,7 @@ bool diffIsDust (STAmount const& v1, STAmount const& v2, std::uint8_t e10)
|
||||
// values are different, but their difference results in an STAmount
|
||||
// with an exponent less than -96.
|
||||
STAmount const diff = large - small;
|
||||
if (diff == zero)
|
||||
if (diff == beast::zero)
|
||||
return true;
|
||||
|
||||
STAmount const ratio = divide (small, diff, v1.issue());
|
||||
|
||||
@@ -72,7 +72,7 @@ const_iterator::operator==(const_iterator const& other) const
|
||||
const_iterator::reference
|
||||
const_iterator::operator*() const
|
||||
{
|
||||
assert(index_ != zero);
|
||||
assert(index_ != beast::zero);
|
||||
if (! cache_)
|
||||
cache_ = view_->read(keylet::child(index_));
|
||||
return *cache_;
|
||||
@@ -81,7 +81,7 @@ const_iterator::operator*() const
|
||||
const_iterator&
|
||||
const_iterator::operator++()
|
||||
{
|
||||
assert(index_ != zero);
|
||||
assert(index_ != beast::zero);
|
||||
if (++it_ != std::end(*indexes_))
|
||||
{
|
||||
index_ = *it_;
|
||||
@@ -93,7 +93,7 @@ const_iterator::operator++()
|
||||
if (next == 0)
|
||||
{
|
||||
page_.key = root_.key;
|
||||
index_ = zero;
|
||||
index_ = beast::zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -103,7 +103,7 @@ const_iterator::operator++()
|
||||
indexes_ = &sle_->getFieldV256(sfIndexes);
|
||||
if (indexes_->empty())
|
||||
{
|
||||
index_ = zero;
|
||||
index_ = beast::zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -120,7 +120,7 @@ const_iterator::operator++()
|
||||
const_iterator
|
||||
const_iterator::operator++(int)
|
||||
{
|
||||
assert(index_ != zero);
|
||||
assert(index_ != beast::zero);
|
||||
const_iterator tmp(*this);
|
||||
++(*this);
|
||||
return tmp;
|
||||
|
||||
@@ -282,7 +282,7 @@ xrpLiquid (ReadView const& view, AccountID const& id,
|
||||
{
|
||||
auto const sle = view.read(keylet::account(id));
|
||||
if (sle == nullptr)
|
||||
return zero;
|
||||
return beast::zero;
|
||||
|
||||
// Return balance minus reserve
|
||||
if (fix1141 (view.info ().parentCloseTime))
|
||||
@@ -1181,9 +1181,9 @@ rippleCredit (ApplyView& view,
|
||||
bool bDelete = false;
|
||||
|
||||
// YYY Could skip this if rippling in reverse.
|
||||
if (saBefore > zero
|
||||
if (saBefore > beast::zero
|
||||
// Sender balance was positive.
|
||||
&& saBalance <= zero
|
||||
&& saBalance <= beast::zero
|
||||
// Sender is zero or negative.
|
||||
&& (uFlags & (!bSenderHigh ? lsfLowReserve : lsfHighReserve))
|
||||
// Sender reserve is set.
|
||||
@@ -1327,7 +1327,7 @@ accountSend (ApplyView& view,
|
||||
AccountID const& uSenderID, AccountID const& uReceiverID,
|
||||
STAmount const& saAmount, beast::Journal j)
|
||||
{
|
||||
assert (saAmount >= zero);
|
||||
assert (saAmount >= beast::zero);
|
||||
|
||||
/* If we aren't sending anything or if the sender is the same as the
|
||||
* receiver then we don't need to do anything.
|
||||
@@ -1456,9 +1456,9 @@ updateTrustLine (
|
||||
assert (sle);
|
||||
|
||||
// YYY Could skip this if rippling in reverse.
|
||||
if (before > zero
|
||||
if (before > beast::zero
|
||||
// Sender balance was positive.
|
||||
&& after <= zero
|
||||
&& after <= beast::zero
|
||||
// Sender is zero or negative.
|
||||
&& (flags & (!bSenderHigh ? lsfLowReserve : lsfHighReserve))
|
||||
// Sender reserve is set.
|
||||
|
||||
@@ -303,7 +303,7 @@ PeerImp::json()
|
||||
ret[jss::complete_ledgers] = std::to_string(minSeq) +
|
||||
" - " + std::to_string(maxSeq);
|
||||
|
||||
if (closedLedgerHash_ != zero)
|
||||
if (closedLedgerHash_ != beast::zero)
|
||||
ret[jss::ledger] = to_string (closedLedgerHash_);
|
||||
|
||||
switch (sanity_.load ())
|
||||
@@ -2312,7 +2312,7 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
|
||||
nData.getDataPtr (), nData.getLength ());
|
||||
|
||||
auto const& stateMap = ledger->stateMap ();
|
||||
if (stateMap.getHash() != zero)
|
||||
if (stateMap.getHash() != beast::zero)
|
||||
{
|
||||
// return account state root node if possible
|
||||
Serializer rootNode (768);
|
||||
@@ -2321,11 +2321,11 @@ PeerImp::getLedger (std::shared_ptr<protocol::TMGetLedger> const& m)
|
||||
reply.add_nodes ()->set_nodedata (
|
||||
rootNode.getDataPtr (), rootNode.getLength ());
|
||||
|
||||
if (ledger->info().txHash != zero)
|
||||
if (ledger->info().txHash != beast::zero)
|
||||
{
|
||||
auto const& txMap = ledger->txMap ();
|
||||
|
||||
if (txMap.getHash() != zero)
|
||||
if (txMap.getHash() != beast::zero)
|
||||
{
|
||||
rootNode.erase ();
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ makeSharedValue (SSL* ssl, beast::Journal journal)
|
||||
|
||||
// Both messages hash to the same value and the cookie
|
||||
// is 0. Don't allow this.
|
||||
if (result == zero)
|
||||
if (result == beast::zero)
|
||||
{
|
||||
JLOG(journal.error()) << "Cookie generation: identical finished messages";
|
||||
return boost::none;
|
||||
|
||||
@@ -120,7 +120,7 @@ inline
|
||||
bool
|
||||
isXRP(AccountID const& c)
|
||||
{
|
||||
return c == zero;
|
||||
return c == beast::zero;
|
||||
}
|
||||
|
||||
// DEPRECATED
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
using beast::zero;
|
||||
|
||||
namespace ripple {
|
||||
|
||||
/** Floating point representation of amounts with high dynamic range
|
||||
@@ -64,7 +62,7 @@ public:
|
||||
|
||||
IOUAmount (beast::Zero)
|
||||
{
|
||||
*this = zero;
|
||||
*this = beast::zero;
|
||||
}
|
||||
|
||||
IOUAmount (std::int64_t mantissa, int exponent)
|
||||
|
||||
@@ -60,7 +60,7 @@ struct TAmounts
|
||||
bool
|
||||
empty() const noexcept
|
||||
{
|
||||
return in <= zero || out <= zero;
|
||||
return in <= beast::zero || out <= beast::zero;
|
||||
}
|
||||
|
||||
TAmounts& operator+=(TAmounts const& rhs)
|
||||
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
|
||||
explicit operator bool() const noexcept
|
||||
{
|
||||
return *this != zero;
|
||||
return *this != beast::zero;
|
||||
}
|
||||
|
||||
STAmount& operator+= (STAmount const&);
|
||||
@@ -217,7 +217,7 @@ public:
|
||||
|
||||
void negate()
|
||||
{
|
||||
if (*this != zero)
|
||||
if (*this != beast::zero)
|
||||
mIsNegative = !mIsNegative;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define RIPPLE_PROTOCOL_STBITSTRING_H_INCLUDED
|
||||
|
||||
#include <ripple/protocol/STBase.h>
|
||||
#include <ripple/beast/utility/Zero.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -118,7 +119,7 @@ public:
|
||||
bool
|
||||
isDefault () const override
|
||||
{
|
||||
return value_ == zero;
|
||||
return value_ == beast::zero;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <ripple/basics/UnorderedContainers.h>
|
||||
#include <ripple/basics/base_uint.h>
|
||||
#include <ripple/protocol/AccountID.h>
|
||||
#include <ripple/beast/utility/Zero.h>
|
||||
|
||||
namespace ripple {
|
||||
namespace detail {
|
||||
@@ -69,7 +70,7 @@ Currency const& badCurrency();
|
||||
|
||||
inline bool isXRP(Currency const& c)
|
||||
{
|
||||
return c == zero;
|
||||
return c == beast::zero;
|
||||
}
|
||||
|
||||
/** Returns "", "XRP", or three letter ISO code. */
|
||||
|
||||
@@ -29,8 +29,6 @@
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
using beast::zero;
|
||||
|
||||
namespace ripple {
|
||||
|
||||
class XRPAmount
|
||||
|
||||
@@ -39,7 +39,7 @@ IOUAmount::normalize ()
|
||||
{
|
||||
if (mantissa_ == 0)
|
||||
{
|
||||
*this = zero;
|
||||
*this = beast::zero;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ IOUAmount::normalize ()
|
||||
|
||||
if ((exponent_ < minExponent) || (mantissa_ < minMantissa))
|
||||
{
|
||||
*this = zero;
|
||||
*this = beast::zero;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -79,10 +79,10 @@ IOUAmount::normalize ()
|
||||
IOUAmount&
|
||||
IOUAmount::operator+= (IOUAmount const& other)
|
||||
{
|
||||
if (other == zero)
|
||||
if (other == beast::zero)
|
||||
return *this;
|
||||
|
||||
if (*this == zero)
|
||||
if (*this == beast::zero)
|
||||
{
|
||||
*this = other;
|
||||
return *this;
|
||||
@@ -109,7 +109,7 @@ IOUAmount::operator+= (IOUAmount const& other)
|
||||
|
||||
if (mantissa_ >= -10 && mantissa_ <= 10)
|
||||
{
|
||||
*this = zero;
|
||||
*this = beast::zero;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ std::string
|
||||
to_string (IOUAmount const& amount)
|
||||
{
|
||||
// keep full internal accuracy, but make more human friendly if possible
|
||||
if (amount == zero)
|
||||
if (amount == beast::zero)
|
||||
return "0";
|
||||
|
||||
int const exponent = amount.exponent ();
|
||||
|
||||
@@ -103,10 +103,10 @@ Quality
|
||||
composed_quality (Quality const& lhs, Quality const& rhs)
|
||||
{
|
||||
STAmount const lhs_rate (lhs.rate ());
|
||||
assert (lhs_rate != zero);
|
||||
assert (lhs_rate != beast::zero);
|
||||
|
||||
STAmount const rhs_rate (rhs.rate ());
|
||||
assert (rhs_rate != zero);
|
||||
assert (rhs_rate != beast::zero);
|
||||
|
||||
STAmount const rate (mulRound (
|
||||
lhs_rate, rhs_rate, lhs_rate.issue (), true));
|
||||
|
||||
@@ -261,7 +261,7 @@ STAmount::STAmount (IOUAmount const& amount, Issue const& issue)
|
||||
: mIssue (issue)
|
||||
, mOffset (amount.exponent ())
|
||||
, mIsNative (false)
|
||||
, mIsNegative (amount < zero)
|
||||
, mIsNegative (amount < beast::zero)
|
||||
{
|
||||
if (mIsNegative)
|
||||
mValue = static_cast<std::uint64_t> (-amount.mantissa ());
|
||||
@@ -274,7 +274,7 @@ STAmount::STAmount (IOUAmount const& amount, Issue const& issue)
|
||||
STAmount::STAmount (XRPAmount const& amount)
|
||||
: mOffset (0)
|
||||
, mIsNative (true)
|
||||
, mIsNegative (amount < zero)
|
||||
, mIsNegative (amount < beast::zero)
|
||||
{
|
||||
if (mIsNegative)
|
||||
mValue = static_cast<std::uint64_t> (-amount.drops ());
|
||||
@@ -345,10 +345,10 @@ STAmount operator+ (STAmount const& v1, STAmount const& v2)
|
||||
if (!areComparable (v1, v2))
|
||||
Throw<std::runtime_error> ("Can't add amounts that are't comparable!");
|
||||
|
||||
if (v2 == zero)
|
||||
if (v2 == beast::zero)
|
||||
return v1;
|
||||
|
||||
if (v1 == zero)
|
||||
if (v1 == beast::zero)
|
||||
{
|
||||
// Result must be in terms of v1 currency and issuer.
|
||||
return { v1.getFName (), v1.issue (),
|
||||
@@ -424,12 +424,12 @@ STAmount::setIssue (Issue const& issue)
|
||||
std::uint64_t
|
||||
getRate (STAmount const& offerOut, STAmount const& offerIn)
|
||||
{
|
||||
if (offerOut == zero)
|
||||
if (offerOut == beast::zero)
|
||||
return 0;
|
||||
try
|
||||
{
|
||||
STAmount r = divide (offerIn, offerOut, noIssue());
|
||||
if (r == zero) // offer is too good
|
||||
if (r == beast::zero) // offer is too good
|
||||
return 0;
|
||||
assert ((r.exponent() >= -100) && (r.exponent() <= 155));
|
||||
std::uint64_t ret = r.exponent() + 100;
|
||||
@@ -494,7 +494,7 @@ std::string
|
||||
STAmount::getText () const
|
||||
{
|
||||
// keep full internal accuracy, but make more human friendly if posible
|
||||
if (*this == zero)
|
||||
if (*this == beast::zero)
|
||||
return "0";
|
||||
|
||||
std::string const raw_value (std::to_string (mValue));
|
||||
@@ -602,7 +602,7 @@ STAmount::add (Serializer& s) const
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*this == zero)
|
||||
if (*this == beast::zero)
|
||||
s.add64 (cNotNative);
|
||||
else if (mIsNegative) // 512 = not native
|
||||
s.add64 (mValue | (static_cast<std::uint64_t>(mOffset + 512 + 97) << (64 - 10)));
|
||||
@@ -1029,10 +1029,10 @@ muldiv_round(
|
||||
STAmount
|
||||
divide (STAmount const& num, STAmount const& den, Issue const& issue)
|
||||
{
|
||||
if (den == zero)
|
||||
if (den == beast::zero)
|
||||
Throw<std::runtime_error> ("division by zero");
|
||||
|
||||
if (num == zero)
|
||||
if (num == beast::zero)
|
||||
return {issue};
|
||||
|
||||
std::uint64_t numVal = num.mantissa();
|
||||
@@ -1073,7 +1073,7 @@ divide (STAmount const& num, STAmount const& den, Issue const& issue)
|
||||
STAmount
|
||||
multiply (STAmount const& v1, STAmount const& v2, Issue const& issue)
|
||||
{
|
||||
if (v1 == zero || v2 == zero)
|
||||
if (v1 == beast::zero || v2 == beast::zero)
|
||||
return STAmount (issue);
|
||||
|
||||
if (v1.native() && v2.native() && isXRP (issue))
|
||||
@@ -1165,7 +1165,7 @@ STAmount
|
||||
mulRound (STAmount const& v1, STAmount const& v2, Issue const& issue,
|
||||
bool roundUp)
|
||||
{
|
||||
if (v1 == zero || v2 == zero)
|
||||
if (v1 == beast::zero || v2 == beast::zero)
|
||||
return {issue};
|
||||
|
||||
bool const xrp = isXRP (issue);
|
||||
@@ -1250,10 +1250,10 @@ STAmount
|
||||
divRound (STAmount const& num, STAmount const& den,
|
||||
Issue const& issue, bool roundUp)
|
||||
{
|
||||
if (den == zero)
|
||||
if (den == beast::zero)
|
||||
Throw<std::runtime_error> ("division by zero");
|
||||
|
||||
if (num == zero)
|
||||
if (num == beast::zero)
|
||||
return {issue};
|
||||
|
||||
std::uint64_t numVal = num.mantissa(), denVal = den.mantissa();
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <ripple/protocol/Serializer.h>
|
||||
#include <ripple/protocol/SystemParameters.h>
|
||||
#include <ripple/protocol/UintTypes.h>
|
||||
#include <ripple/protocol/UintTypes.h>
|
||||
#include <ripple/beast/utility/Zero.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -34,7 +34,7 @@ std::string to_string(Currency const& currency)
|
||||
"0123456789"
|
||||
"<>(){}[]|?!@#$%^&*";
|
||||
|
||||
if (currency == zero)
|
||||
if (currency == beast::zero)
|
||||
return systemCurrencyCode();
|
||||
|
||||
if (currency == noCurrency())
|
||||
@@ -68,7 +68,7 @@ bool to_currency(Currency& currency, std::string const& code)
|
||||
{
|
||||
if (code.empty () || !code.compare (systemCurrencyCode()))
|
||||
{
|
||||
currency = zero;
|
||||
currency = beast::zero;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ Json::Value doBookOffers (RPC::Context& context)
|
||||
context.netOps.getBookPage (
|
||||
lpLedger,
|
||||
{{pay_currency, pay_issuer}, {get_currency, get_issuer}},
|
||||
takerID ? *takerID : zero, bProof, limit, jvMarker, jvResult);
|
||||
takerID ? *takerID : beast::zero, bProof, limit, jvMarker, jvResult);
|
||||
|
||||
context.loadType = Resource::feeMediumBurdenRPC;
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ Json::Value doGatewayBalances (RPC::Context& context)
|
||||
{
|
||||
// normal negative balance, obligation to customer
|
||||
auto& bal = sums[rs->getBalance().getCurrency()];
|
||||
if (bal == zero)
|
||||
if (bal == beast::zero)
|
||||
{
|
||||
// This is needed to set the currency code correctly
|
||||
bal = -rs->getBalance();
|
||||
|
||||
@@ -77,7 +77,7 @@ Json::Value doLedgerEntry (RPC::Context& context)
|
||||
! uNodeIndex.SetHex (
|
||||
context.params[jss::deposit_preauth].asString()))
|
||||
{
|
||||
uNodeIndex = zero;
|
||||
uNodeIndex = beast::zero;
|
||||
jvResult[jss::error] = "malformedRequest";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ Json::Value doLedgerRequest (RPC::Context& context)
|
||||
neededHash = hashOfSeq(*ledger, ledgerIndex, j);
|
||||
}
|
||||
assert (neededHash);
|
||||
ledgerHash = neededHash ? *neededHash : zero; // kludge
|
||||
ledgerHash = neededHash ? *neededHash : beast::zero; // kludge
|
||||
}
|
||||
|
||||
// Try to get the desired ledger
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/shamap/SHAMapMissingNode.h>
|
||||
#include <ripple/beast/utility/Zero.h>
|
||||
#include <ostream>
|
||||
|
||||
namespace ripple {
|
||||
@@ -41,7 +42,7 @@ operator<< (std::ostream& out, const SHAMapMissingNode& mn)
|
||||
break;
|
||||
};
|
||||
|
||||
if (mn.mNodeHash == zero)
|
||||
if (mn.mNodeHash == beast::zero)
|
||||
out << "id : " << mn.mNodeID;
|
||||
else
|
||||
out << "hash : " << mn.mNodeHash;
|
||||
|
||||
@@ -78,7 +78,7 @@ class Taker_test : public beast::unit_test::suite
|
||||
return Amounts (offer.in.zeroed (), offer.out.zeroed ());
|
||||
|
||||
// we need to emulate "unfunded offers" behavior
|
||||
if (get_funds (AccountID (0x4702), offer.out) == zero)
|
||||
if (get_funds (AccountID (0x4702), offer.out) == beast::zero)
|
||||
return Amounts (offer.in.zeroed (), offer.out.zeroed ());
|
||||
|
||||
if (done ())
|
||||
|
||||
@@ -83,14 +83,14 @@ inline Path& Path::push_back (STPathElement const& pe)
|
||||
inline Path& Path::push_back (Issue const& iss)
|
||||
{
|
||||
path.emplace_back (STPathElement::typeCurrency | STPathElement::typeIssuer,
|
||||
zero, iss.currency, iss.account);
|
||||
beast::zero, iss.currency, iss.account);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
Path& Path::push_back (jtx::Account const& account)
|
||||
{
|
||||
path.emplace_back (account.id (), zero, zero);
|
||||
path.emplace_back (account.id (), beast::zero, beast::zero);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,13 +35,13 @@ public:
|
||||
BEAST_EXPECT(z.exponent () == -100);
|
||||
BEAST_EXPECT(!z);
|
||||
BEAST_EXPECT(z.signum () == 0);
|
||||
BEAST_EXPECT(z == zero);
|
||||
BEAST_EXPECT(z == beast::zero);
|
||||
|
||||
BEAST_EXPECT((z + z) == z);
|
||||
BEAST_EXPECT((z - z) == z);
|
||||
BEAST_EXPECT(z == -z);
|
||||
|
||||
IOUAmount const zz (zero);
|
||||
IOUAmount const zz (beast::zero);
|
||||
BEAST_EXPECT(z == zz);
|
||||
}
|
||||
|
||||
@@ -63,6 +63,8 @@ public:
|
||||
{
|
||||
testcase ("beast::Zero Comparisons");
|
||||
|
||||
using beast::zero;
|
||||
|
||||
{
|
||||
IOUAmount z (zero);
|
||||
BEAST_EXPECT(z == zero);
|
||||
@@ -201,8 +203,8 @@ public:
|
||||
// tiny negative numbers
|
||||
IOUAmount tinyNeg (-minMantissa, minExponent);
|
||||
// Round up should give zero
|
||||
BEAST_EXPECT(zero == mulRatio (tinyNeg, 1, maxUInt, true));
|
||||
BEAST_EXPECT(zero == mulRatio (tinyNeg, maxUInt - 1, maxUInt, true));
|
||||
BEAST_EXPECT(beast::zero == mulRatio (tinyNeg, 1, maxUInt, true));
|
||||
BEAST_EXPECT(beast::zero == mulRatio (tinyNeg, maxUInt - 1, maxUInt, true));
|
||||
// rounding down should be tiny
|
||||
BEAST_EXPECT(tinyNeg == mulRatio (tinyNeg, 1, maxUInt, false));
|
||||
BEAST_EXPECT(tinyNeg == mulRatio (tinyNeg, maxUInt - 1, maxUInt, false));
|
||||
|
||||
@@ -233,7 +233,7 @@ public:
|
||||
raw (4131113916555555, -16)); // .4131113916555555
|
||||
Amounts const result (
|
||||
q.ceil_out (value, limit));
|
||||
BEAST_EXPECT(result.in != zero);
|
||||
BEAST_EXPECT(result.in != beast::zero);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -211,9 +211,9 @@ public:
|
||||
unexpected (serializeAndDeserialize (hundred) != hundred, "STAmount fail");
|
||||
unexpected (!zeroSt.native (), "STAmount fail");
|
||||
unexpected (!hundred.native (), "STAmount fail");
|
||||
unexpected (zeroSt != zero, "STAmount fail");
|
||||
unexpected (one == zero, "STAmount fail");
|
||||
unexpected (hundred == zero, "STAmount fail");
|
||||
unexpected (zeroSt != beast::zero, "STAmount fail");
|
||||
unexpected (one == beast::zero, "STAmount fail");
|
||||
unexpected (hundred == beast::zero, "STAmount fail");
|
||||
unexpected ((zeroSt < zeroSt), "STAmount fail");
|
||||
unexpected (! (zeroSt < one), "STAmount fail");
|
||||
unexpected (! (zeroSt < hundred), "STAmount fail");
|
||||
@@ -294,9 +294,9 @@ public:
|
||||
unexpected (serializeAndDeserialize (hundred) != hundred, "STAmount fail");
|
||||
unexpected (zeroSt.native (), "STAmount fail");
|
||||
unexpected (hundred.native (), "STAmount fail");
|
||||
unexpected (zeroSt != zero, "STAmount fail");
|
||||
unexpected (one == zero, "STAmount fail");
|
||||
unexpected (hundred == zero, "STAmount fail");
|
||||
unexpected (zeroSt != beast::zero, "STAmount fail");
|
||||
unexpected (one == beast::zero, "STAmount fail");
|
||||
unexpected (hundred == beast::zero, "STAmount fail");
|
||||
unexpected ((zeroSt < zeroSt), "STAmount fail");
|
||||
unexpected (! (zeroSt < one), "STAmount fail");
|
||||
unexpected (! (zeroSt < hundred), "STAmount fail");
|
||||
@@ -460,21 +460,21 @@ public:
|
||||
|
||||
STAmount smallXsmall = multiply (smallValue, smallValue, noIssue());
|
||||
|
||||
BEAST_EXPECT(smallXsmall == zero);
|
||||
BEAST_EXPECT(smallXsmall == beast::zero);
|
||||
|
||||
STAmount bigDsmall = divide (smallValue, bigValue, noIssue());
|
||||
|
||||
BEAST_EXPECT(bigDsmall == zero);
|
||||
BEAST_EXPECT(bigDsmall == beast::zero);
|
||||
|
||||
BEAST_EXPECT(bigDsmall == zero);
|
||||
BEAST_EXPECT(bigDsmall == beast::zero);
|
||||
|
||||
bigDsmall = divide (smallValue, bigValue, xrpIssue ());
|
||||
|
||||
BEAST_EXPECT(bigDsmall == zero);
|
||||
BEAST_EXPECT(bigDsmall == beast::zero);
|
||||
|
||||
bigDsmall = divide (smallValue, bigNative, xrpIssue ());
|
||||
|
||||
BEAST_EXPECT(bigDsmall == zero);
|
||||
BEAST_EXPECT(bigDsmall == beast::zero);
|
||||
|
||||
// very bad offer
|
||||
std::uint64_t r = getRate (smallValue, bigValue);
|
||||
|
||||
@@ -46,6 +46,8 @@ public:
|
||||
{
|
||||
testcase ("beast::Zero Comparisons");
|
||||
|
||||
using beast::zero;
|
||||
|
||||
for (auto i : { -1, 0, 1})
|
||||
{
|
||||
XRPAmount const x (i);
|
||||
@@ -145,8 +147,8 @@ public:
|
||||
// tiny negative numbers
|
||||
XRPAmount tinyNeg (-1);
|
||||
// Round up should give zero
|
||||
BEAST_EXPECT(zero == mulRatio (tinyNeg, 1, maxUInt32, true));
|
||||
BEAST_EXPECT(zero == mulRatio (tinyNeg, maxUInt32 - 1, maxUInt32, true));
|
||||
BEAST_EXPECT(beast::zero == mulRatio (tinyNeg, 1, maxUInt32, true));
|
||||
BEAST_EXPECT(beast::zero == mulRatio (tinyNeg, maxUInt32 - 1, maxUInt32, true));
|
||||
// rounding down should be tiny
|
||||
BEAST_EXPECT(tinyNeg == mulRatio (tinyNeg, maxUInt32 - 1, maxUInt32, false));
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ public:
|
||||
if (! backed)
|
||||
map.setUnbacked ();
|
||||
|
||||
BEAST_EXPECT(map.getHash() == zero);
|
||||
BEAST_EXPECT(map.getHash() == beast::zero);
|
||||
for (int k = 0; k < keys.size(); ++k)
|
||||
{
|
||||
SHAMapItem item (keys[k], IntToVUC (k));
|
||||
@@ -282,7 +282,7 @@ public:
|
||||
BEAST_EXPECT(map.delItem (keys[k]));
|
||||
map.invariants();
|
||||
}
|
||||
BEAST_EXPECT(map.getHash() == zero);
|
||||
BEAST_EXPECT(map.getHash() == beast::zero);
|
||||
}
|
||||
|
||||
if (backed)
|
||||
|
||||
Reference in New Issue
Block a user