mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-29 13:21:05 +00:00
Simplify remove_trailing_zeros
This commit is contained in:
parent
b348caa9e9
commit
c04af4bfc7
@ -1876,12 +1876,9 @@ FMT_INLINE int remove_trailing_zeros(uint64_t& n) noexcept {
|
|||||||
int s = 8;
|
int s = 8;
|
||||||
while (true) {
|
while (true) {
|
||||||
auto q = rotr(n32 * mod_inv_25, 2);
|
auto q = rotr(n32 * mod_inv_25, 2);
|
||||||
if (q <= std::numeric_limits<uint32_t>::max() / 100) {
|
if (q > std::numeric_limits<uint32_t>::max() / 100) break;
|
||||||
n32 = q;
|
n32 = q;
|
||||||
s += 2;
|
s += 2;
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
auto q = rotr(n32 * mod_inv_5, 1);
|
auto q = rotr(n32 * mod_inv_5, 1);
|
||||||
if (q <= std::numeric_limits<uint32_t>::max() / 10) {
|
if (q <= std::numeric_limits<uint32_t>::max() / 10) {
|
||||||
@ -1900,12 +1897,9 @@ FMT_INLINE int remove_trailing_zeros(uint64_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<uint64_t>::max() / 100) {
|
if (q > std::numeric_limits<uint64_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<uint64_t>::max() / 10) {
|
if (q <= std::numeric_limits<uint64_t>::max() / 10) {
|
||||||
|
Loading…
Reference in New Issue
Block a user