mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Include rounding mode in XRPAmount to STAmount conversion.
This commit is contained in:
committed by
Elliot Lee
parent
6fcd654bee
commit
e354497f63
@@ -186,10 +186,6 @@ mulRatio(
|
||||
std::uint32_t den,
|
||||
bool roundUp);
|
||||
|
||||
// Since IOUAmount and STAmount do not have access to a ledger, this
|
||||
// is needed to put low-level routines on an amendment switch. Only
|
||||
// transactions need to use this switchover. Outside of a transaction
|
||||
// it's safe to unconditionally use the new behavior.
|
||||
extern LocalValue<bool> stNumberSwitchover;
|
||||
|
||||
/** RAII class to set and restore the Number switchover.
|
||||
|
||||
@@ -337,6 +337,24 @@ squelch(Number const& x, Number const& limit) noexcept
|
||||
return x;
|
||||
}
|
||||
|
||||
class saveNumberRoundMode
|
||||
{
|
||||
Number::rounding_mode mode_;
|
||||
|
||||
public:
|
||||
~saveNumberRoundMode()
|
||||
{
|
||||
Number::setround(mode_);
|
||||
}
|
||||
explicit saveNumberRoundMode(Number::rounding_mode mode) noexcept
|
||||
: mode_{mode}
|
||||
{
|
||||
}
|
||||
saveNumberRoundMode(saveNumberRoundMode const&) = delete;
|
||||
saveNumberRoundMode&
|
||||
operator=(saveNumberRoundMode const&) = delete;
|
||||
};
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
#endif // RIPPLE_BASICS_NUMBER_H_INCLUDED
|
||||
|
||||
Reference in New Issue
Block a user