# HG changeset patch # User Arun Giridhar # Date 1669211999 18000 # Node ID 8027b17bcb9205ffbb517b15b88081c973bbc5e5 # Parent bbd07d0f587be8a3ce8eb6d12ae75aafe2ad7fc1# Parent 88d2395500e7eeb523381da23113e1fc70946b37 maint: Merge stable to default. diff -r bbd07d0f587b -r 8027b17bcb92 libinterp/corefcn/__isprimelarge__.cc --- a/libinterp/corefcn/__isprimelarge__.cc Wed Nov 23 05:23:12 2022 -0500 +++ b/libinterp/corefcn/__isprimelarge__.cc Wed Nov 23 08:59:59 2022 -0500 @@ -213,12 +213,12 @@ // factorization algorithm with Brent update. // The code is short and simple, but the math behind it is complicated. uint64_t -pollardrho (uint64_t n, uint64_t c = UINT64_C (1)) +pollardrho (uint64_t n, uint64_t c = 1) { - uint64_t i = UINT64_C (1), j = UINT64_C (2); // cycle index values - uint64_t x = (c+1) % n; // can also be rand () % n - uint64_t y = x; // other value in the chain - uint64_t g = 0; // GCD + uint64_t i = 1, j = 2; // cycle index values + uint64_t x = (c+1) % n; // can also be rand () % n + uint64_t y = x; // other value in the chain + uint64_t g = 0; // GCD while (true) { @@ -238,10 +238,10 @@ j <<= 1; } - if (g == n || i > UINT64_C (1000000)) // cut losses, restart with a different c + if (g == n || i > 1000000) // cut losses, restart with a different c return pollardrho (n, c + 2); - if (g > UINT64_C (1)) // found GCD ==> exit loop properly + if (g > 1) // found GCD ==> exit loop properly { error_unless (n % g == 0); // theoretical possibility of GCD error return g;