commit 570ab0f47d1f398d19f16fcbb4154ab1beaa21f5
parent 268d626041544256a04b10fe0dc0bd69c3218dd0
Author: Santtu Lakkala <inz@inz.fi>
Date: Tue, 4 Jan 2022 14:25:45 +0200
Optimize
Diffstat:
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/sssms2.c b/sssms2.c
@@ -60,14 +60,11 @@ void *worker(void *data)
for (b = 1; b <= a; b++) {
const uint8_t f3 = f2[a & 7][b & 7];
if (f3) {
- uint64_t a2b2 = a * a + b * b;
- uint64_t mrc = sqrtl(a2b2 + b);
+ const uint64_t a2b2 = a * a + b * b;
uint64_t rc;
for (rc = sqrt(a2b2 - 1) + 1;
- rc <= mrc; rc++) {
- c = rc * rc - a2b2;
-
+ (c = rc * rc - a2b2) <= b; rc++) {
if (f3 & (1 << (c & 7)) &&
issquare(a * a + b + c * c) &&
issquare(a + b * b + c * c))