Remove using namespace beast in base_uint.h

This commit is contained in:
Joe Loser
2018-07-13 21:08:20 -04:00
committed by Nik Bougalis
parent 79d819584f
commit 70d9d88cda
62 changed files with 206 additions and 196 deletions

View File

@@ -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();