mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-05 01:37:00 +00:00
Significant rewrite
- Simplify Number::operator/= to use more constexpr values, and fewer
variations.
- Most significantly, rounding up doesn't need more precision, it only
needs to know if there's a remainder after the current precision work
is done. Tracked similarly Guard::xbit_.
- Build a constexpr lookup array for powers of 10. Only a handful of
values are used, but since it's built at compile time, and constexpr,
unused values do not affect memory or performance.
This commit is contained in:
@@ -50,11 +50,15 @@ class Number_test : public beast::unit_test::Suite
|
||||
{
|
||||
T p = 1;
|
||||
if (n >= 0)
|
||||
{
|
||||
for (int i = 0; i < n; ++i)
|
||||
p *= 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < -n; ++i)
|
||||
p /= 10;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user