aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coreutils/factor.c6
1 files changed, 0 insertions, 6 deletions
diff --git a/coreutils/factor.c b/coreutils/factor.c
index 1c01e3f27..85284aa27 100644
--- a/coreutils/factor.c
+++ b/coreutils/factor.c
@@ -89,7 +89,6 @@ static NOINLINE half_t isqrt_odd(wide_t N)
89 89
90static NOINLINE void factorize(wide_t N) 90static NOINLINE void factorize(wide_t N)
91{ 91{
92 wide_t factor2;
93 half_t factor; 92 half_t factor;
94 half_t max_factor; 93 half_t max_factor;
95 unsigned count3; 94 unsigned count3;
@@ -105,7 +104,6 @@ static NOINLINE void factorize(wide_t N)
105 max_factor = isqrt_odd(N); 104 max_factor = isqrt_odd(N);
106 count3 = 3; 105 count3 = 3;
107 factor = 3; 106 factor = 3;
108 factor2 = 3 * 3;
109 for (;;) { 107 for (;;) {
110 /* The division is the most costly part of the loop. 108 /* The division is the most costly part of the loop.
111 * On 64bit CPUs, takes at best 12 cycles, often ~20. 109 * On 64bit CPUs, takes at best 12 cycles, often ~20.
@@ -118,10 +116,6 @@ static NOINLINE void factorize(wide_t N)
118 next_factor: 116 next_factor:
119 if (factor >= max_factor) 117 if (factor >= max_factor)
120 break; 118 break;
121 /* (f + 2)^2 = f^2 + 4*f + 4 = f^2 + 4*(f+1) */
122 factor2 = factor2 + 4 * (factor + 1);
123 /* overflow is impossible due to max_factor check */
124 /* (factor2 > N) is impossible due to max_factor check */
125 factor += 2; 119 factor += 2;
126 /* Rudimentary wheel sieving: skip multiples of 3: 120 /* Rudimentary wheel sieving: skip multiples of 3:
127 * Every third odd number is divisible by three and thus isn't a prime: 121 * Every third odd number is divisible by three and thus isn't a prime: