Expand use of Asset::integral()

This commit is contained in:
Ed Hennis
2025-10-21 20:01:55 -04:00
parent 8757022312
commit f6098fd80b
6 changed files with 30 additions and 11 deletions

View File

@@ -174,6 +174,9 @@ public:
int
exponent() const noexcept;
bool
integral() const noexcept;
bool
native() const noexcept;
@@ -454,6 +457,12 @@ STAmount::exponent() const noexcept
return mOffset;
}
inline bool
STAmount::integral() const noexcept
{
return mAsset.integral();
}
inline bool
STAmount::native() const noexcept
{
@@ -735,7 +744,7 @@ roundToAsset(
{
NumberRoundModeGuard mg(rounding);
STAmount const ret{asset, value};
if (ret.asset().native() || !ret.asset().holds<Issue>())
if (ret.integral())
return ret;
// Not that the ctor will round integral types (XRP, MPT) via canonicalize,
// so no extra work is needed for those.