aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples
diff options
context:
space:
mode:
Diffstat (limited to 'doc/examples')
-rw-r--r--doc/examples/factor.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/doc/examples/factor.cpp b/doc/examples/factor.cpp
index 163d83fe0..bdd6319b7 100644
--- a/doc/examples/factor.cpp
+++ b/doc/examples/factor.cpp
@@ -28,15 +28,15 @@ BigInt rho(const BigInt& n)
{
i++;
+ if(i == 0) // overflow, bail out
+ break;
+
x = mod_n.multiply((x + 1), x);
d = gcd(y - x, n);
if(d != 1 && d != n)
return d;
- if(i == 65536) // bail
- break;
-
if(i == k)
{
y = x;