xrpld
Loading...
Searching...
No Matches
xrpl::Number::Guard Class Reference
Collaboration diagram for xrpl::Number::Guard:

Public Member Functions

 Guard ()=default
void setPositive () noexcept
void setNegative () noexcept
void setDropped () noexcept
bool isNegative () const noexcept
template<class T>
void push (T d) noexcept
unsigned pop () noexcept
template<class T>
void doDropDigit (T &mantissa, int &exponent) noexcept
 Drop a digit from the mantissa, and increment the exponent, storing the dropped digit in this Guard.
int round () const noexcept
template<UnsignedMantissa T>
void doRoundUp (bool &negative, T &mantissa, int &exponent, internalrep const &minMantissa, internalrep const &maxMantissa, MantissaRange::CuspRoundingFix cuspRoundingFixEnabled, std::string location)
template<UnsignedMantissa T>
void doRoundDown (bool &negative, T &mantissa, int &exponent, internalrep const &minMantissa)
void doRound (rep &drops, std::string location) const
template<>
void doDropDigit (uint128_t &mantissa, int &exponent) noexcept

Private Member Functions

void doPush (unsigned d) noexcept
template<UnsignedMantissa T>
void bringIntoRange (bool &negative, T &mantissa, int &exponent, internalrep const &minMantissa)

Private Attributes

std::uint64_t digits_ {0}
std::uint8_t xbit_: 1 {0}
std::uint8_t sbit_: 1 {0}

Detailed Description

Definition at line 167 of file Number.cpp.

Constructor & Destructor Documentation

◆ Guard()

xrpl::Number::Guard::Guard ( )
explicitdefault

Member Function Documentation

◆ setPositive()

void xrpl::Number::Guard::setPositive ( )
noexcept

Definition at line 246 of file Number.cpp.

◆ setNegative()

void xrpl::Number::Guard::setNegative ( )
noexcept

Definition at line 252 of file Number.cpp.

◆ setDropped()

void xrpl::Number::Guard::setDropped ( )
noexcept

Definition at line 258 of file Number.cpp.

◆ isNegative()

bool xrpl::Number::Guard::isNegative ( ) const
nodiscardnoexcept

Definition at line 264 of file Number.cpp.

◆ push()

template<class T>
void xrpl::Number::Guard::push ( T d)
noexcept

Definition at line 279 of file Number.cpp.

◆ pop()

unsigned xrpl::Number::Guard::pop ( )
noexcept

Definition at line 285 of file Number.cpp.

◆ doDropDigit() [1/2]

template<class T>
void xrpl::Number::Guard::doDropDigit ( T & mantissa,
int & exponent )
noexcept

Drop a digit from the mantissa, and increment the exponent, storing the dropped digit in this Guard.

Substitute for: push(mantissa % 10); mantissa /= 10; ++exponent;

Definition at line 294 of file Number.cpp.

◆ round()

int xrpl::Number::Guard::round ( ) const
nodiscardnoexcept

Definition at line 318 of file Number.cpp.

◆ doRoundUp()

template<UnsignedMantissa T>
void xrpl::Number::Guard::doRoundUp ( bool & negative,
T & mantissa,
int & exponent,
internalrep const & minMantissa,
internalrep const & maxMantissa,
MantissaRange::CuspRoundingFix cuspRoundingFixEnabled,
std::string location )

Definition at line 381 of file Number.cpp.

◆ doRoundDown()

template<UnsignedMantissa T>
void xrpl::Number::Guard::doRoundDown ( bool & negative,
T & mantissa,
int & exponent,
internalrep const & minMantissa )

Definition at line 450 of file Number.cpp.

◆ doRound()

void xrpl::Number::Guard::doRound ( rep & drops,
std::string location ) const

Definition at line 471 of file Number.cpp.

◆ doPush()

void xrpl::Number::Guard::doPush ( unsigned d)
privatenoexcept

Definition at line 270 of file Number.cpp.

◆ bringIntoRange()

template<UnsignedMantissa T>
void xrpl::Number::Guard::bringIntoRange ( bool & negative,
T & mantissa,
int & exponent,
internalrep const & minMantissa )
private

Definition at line 356 of file Number.cpp.

◆ doDropDigit() [2/2]

template<>
void xrpl::Number::Guard::doDropDigit ( uint128_t & mantissa,
int & exponent )
noexcept

Definition at line 303 of file Number.cpp.

Member Data Documentation

◆ digits_

std::uint64_t xrpl::Number::Guard::digits_ {0}
private

Definition at line 169 of file Number.cpp.

◆ xbit_

std::uint8_t xrpl::Number::Guard::xbit_
private

Definition at line 170 of file Number.cpp.

◆ sbit_

std::uint8_t xrpl::Number::Guard::sbit_
private

Definition at line 171 of file Number.cpp.