Commit c8bd1e64 authored by Junekey Jeon's avatar Junekey Jeon Committed by Victor Zverovich

Simplify remove_trailing_zeros

parent 9b23e9dc
...@@ -1843,12 +1843,9 @@ FMT_INLINE int remove_trailing_zeros(uint32_t& n) noexcept { ...@@ -1843,12 +1843,9 @@ FMT_INLINE int remove_trailing_zeros(uint32_t& n) noexcept {
int s = 0; int s = 0;
while (true) { while (true) {
auto q = rotr(n * mod_inv_25, 2); auto q = rotr(n * mod_inv_25, 2);
if (q <= std::numeric_limits<uint32_t>::max() / 100) { if (q > std::numeric_limits<uint32_t>::max() / 100) break;
n = q; n = q;
s += 2; s += 2;
} else {
break;
}
} }
auto q = rotr(n * mod_inv_5, 1); auto q = rotr(n * mod_inv_5, 1);
if (q <= std::numeric_limits<uint32_t>::max() / 10) { if (q <= std::numeric_limits<uint32_t>::max() / 10) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment