From: Paul Eggert Date: Sun, 8 Jun 2025 07:59:44 +0000 (-0700) Subject: factor: use primes_diff more consistently X-Git-Tag: v9.8~220 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f7d295d941bbc7c69c6b0a6b8f46a58080af1127;p=thirdparty%2Fcoreutils.git factor: use primes_diff more consistently * src/factor.c (mp_factor_using_division): Use index into primes_diff consistently with other uses. This is mostly just a style change, and likely doesn’t change the generated machine code. --- diff --git a/src/factor.c b/src/factor.c index 8e52f0f50b..52209eb7e8 100644 --- a/src/factor.c +++ b/src/factor.c @@ -908,7 +908,7 @@ mp_factor_using_division (mpz_t t, struct mp_factors *factors) } unsigned long int d = 3; - for (idx_t i = 1; i <= PRIMES_PTAB_ENTRIES;) + for (idx_t i = 0; i < PRIMES_PTAB_ENTRIES; i++) { for (m = 0; mpz_divisible_ui_p (t, d); m++) { @@ -921,7 +921,7 @@ mp_factor_using_division (mpz_t t, struct mp_factors *factors) } if (m) mp_factor_insert_ui (factors, d, m); - d += primes_diff[i++]; + d += primes_diff[i + 1]; if (mpz_cmp_ui (t, d * d) < 0) break; }