[Gmp-commit] /var/hg/gmp: Overhaul.
mercurial at gmplib.org
mercurial at gmplib.org
Fri Aug 24 18:43:42 CEST 2012
details: /var/hg/gmp/rev/7677276bdf92
changeset: 15078:7677276bdf92
user: Torbjorn Granlund <tege at gmplib.org>
date: Fri Aug 24 18:43:40 2012 +0200
description:
Overhaul.
diffstat:
ChangeLog | 4 ++++
demos/factorize.c | 21 ++-------------------
2 files changed, 6 insertions(+), 19 deletions(-)
diffs (61 lines):
diff -r 5eb5cd992d7a -r 7677276bdf92 ChangeLog
--- a/ChangeLog Sun Aug 12 23:52:51 2012 +0200
+++ b/ChangeLog Fri Aug 24 18:43:40 2012 +0200
@@ -1,3 +1,7 @@
+2012-08-24 Torbjorn Granlund <tege at gmplib.org>
+
+ * demos/factorize.c: Overhaul.
+
2012-08-06 Marco Bodrato <bodrato at mail.dm.unipi.it>
* doc/gmp.texi (mpn_neg): Correctly document returned type.
diff -r 5eb5cd992d7a -r 7677276bdf92 demos/factorize.c
--- a/demos/factorize.c Sun Aug 12 23:52:51 2012 +0200
+++ b/demos/factorize.c Fri Aug 24 18:43:40 2012 +0200
@@ -187,10 +187,6 @@
}
while (--k != 0);
- mpz_gcd (t1, P, n);
- if (mpz_cmp_ui (t1, 1) != 0)
- goto factor_found;
-
mpz_set (x1, x);
k = l;
l = 2 * l;
@@ -233,20 +229,12 @@
if (!mpz_probab_prime_p (t1, 25))
{
- do
- {
- mp_limb_t a_limb;
- mpn_random (&a_limb, (mp_size_t) 1);
- a = a_limb;
- }
- while (a == 0);
-
if (flag_verbose > 0)
{
printf ("[composite factor--restarting pollard-rho] ");
fflush (stdout);
}
- factor_using_pollard_rho (t1, a, p);
+ factor_using_pollard_rho (t1, a + 1, p);
}
else
{
@@ -277,12 +265,7 @@
if (mpz_sgn (t) == 0)
return;
- /* Set the trial division limit according the size of t. */
- division_limit = mpz_sizeinbase (t, 2);
- if (division_limit > 1000)
- division_limit = 1000 * 1000;
- else
- division_limit = division_limit * division_limit;
+ division_limit = 1500;
if (p != 0)
factor_using_division_2kp (t, division_limit / 10, p);
More information about the gmp-commit
mailing list