We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6d38e19 commit bdfa306Copy full SHA for bdfa306
include/boost/decimal/detail/remove_trailing_zeros.hpp
@@ -85,9 +85,15 @@ constexpr auto remove_trailing_zeros(std::uint64_t n) noexcept -> remove_trailin
85
return {n, s};
86
}
87
88
-// TODO(mborland): Make this better. Check lower word for equal to 0.
+// TODO(mborland): Make this better for the 2-word case
89
constexpr auto remove_trailing_zeros(uint128 n) noexcept -> remove_trailing_zeros_return<uint128>
90
{
91
+ if (n.high == UINT64_C(0))
92
+ {
93
+ const auto temp {remove_trailing_zeros(n.low)};
94
+ return {static_cast<uint128>(temp.trimmed_number), temp.number_of_removed_zeros};
95
+ }
96
+
97
std::size_t s {};
98
99
while (n % 10 == 0)
0 commit comments