factor: factor2 variable is unused now, drop it
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
7e5f2f3b51
commit
c804d4ec5c
@ -89,7 +89,6 @@ static NOINLINE half_t isqrt_odd(wide_t N)
|
|||||||
|
|
||||||
static NOINLINE void factorize(wide_t N)
|
static NOINLINE void factorize(wide_t N)
|
||||||
{
|
{
|
||||||
wide_t factor2;
|
|
||||||
half_t factor;
|
half_t factor;
|
||||||
half_t max_factor;
|
half_t max_factor;
|
||||||
unsigned count3;
|
unsigned count3;
|
||||||
@ -105,7 +104,6 @@ static NOINLINE void factorize(wide_t N)
|
|||||||
max_factor = isqrt_odd(N);
|
max_factor = isqrt_odd(N);
|
||||||
count3 = 3;
|
count3 = 3;
|
||||||
factor = 3;
|
factor = 3;
|
||||||
factor2 = 3 * 3;
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
/* The division is the most costly part of the loop.
|
/* The division is the most costly part of the loop.
|
||||||
* On 64bit CPUs, takes at best 12 cycles, often ~20.
|
* On 64bit CPUs, takes at best 12 cycles, often ~20.
|
||||||
@ -118,10 +116,6 @@ static NOINLINE void factorize(wide_t N)
|
|||||||
next_factor:
|
next_factor:
|
||||||
if (factor >= max_factor)
|
if (factor >= max_factor)
|
||||||
break;
|
break;
|
||||||
/* (f + 2)^2 = f^2 + 4*f + 4 = f^2 + 4*(f+1) */
|
|
||||||
factor2 = factor2 + 4 * (factor + 1);
|
|
||||||
/* overflow is impossible due to max_factor check */
|
|
||||||
/* (factor2 > N) is impossible due to max_factor check */
|
|
||||||
factor += 2;
|
factor += 2;
|
||||||
/* Rudimentary wheel sieving: skip multiples of 3:
|
/* Rudimentary wheel sieving: skip multiples of 3:
|
||||||
* Every third odd number is divisible by three and thus isn't a prime:
|
* Every third odd number is divisible by three and thus isn't a prime:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user