[Gmp-commit] /var/hg/gmp: 2 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Wed May 2 14:30:59 CEST 2012
details: /var/hg/gmp/rev/45166f1f7a18
changeset: 14934:45166f1f7a18
user: Torbjorn Granlund <tege at gmplib.org>
date: Wed May 02 14:14:10 2012 +0200
description:
Add a FIXME.
details: /var/hg/gmp/rev/a6ee205d1547
changeset: 14935:a6ee205d1547
user: Torbjorn Granlund <tege at gmplib.org>
date: Wed May 02 14:30:57 2012 +0200
description:
Trivial merge.
diffstat:
ChangeLog | 4 ++++
mpz/mfac_uiui.c | 19 ++++++++++++-------
tests/mpz/t-gcd.c | 2 +-
3 files changed, 17 insertions(+), 8 deletions(-)
diffs (65 lines):
diff -r 6daa4e5ce87e -r a6ee205d1547 ChangeLog
--- a/ChangeLog Wed May 02 12:36:58 2012 +0200
+++ b/ChangeLog Wed May 02 14:30:57 2012 +0200
@@ -1,3 +1,7 @@
+2012-05-02 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+ * mpz/mfac_uiui.c: Support limb != ui.
+
2012-05-02 Torbjorn Granlund <tege at gmplib.org>
* mpn/arm/logops_n.asm: Work around register clobbering issue.
diff -r 6daa4e5ce87e -r a6ee205d1547 mpz/mfac_uiui.c
--- a/mpz/mfac_uiui.c Wed May 02 12:36:58 2012 +0200
+++ b/mpz/mfac_uiui.c Wed May 02 14:30:57 2012 +0200
@@ -54,7 +54,8 @@
mp_limb_t g, sn;
mpz_t t;
- g = mpn_gcd_1 (&n, 1, m);
+ sn = n;
+ g = mpn_gcd_1 (&sn, 1, m);
if (g != 1) { n/=g; m/=g; }
if (m <= 2) { /* fac or 2fac */
@@ -63,18 +64,22 @@
mpz_init (t);
mpz_fac_ui (t, n);
sn = n;
- } else if (g == 2) {
- mpz_2fac_ui (x, n << 1);
- g = 1;
- } else
- mpz_fac_ui (x, n);
+ } else {
+ if (g == 2)
+ mpz_2fac_ui (x, n << 1);
+ else
+ mpz_fac_ui (x, n);
+ return;
+ }
} else { /* m == 2 */
if (g != 1) {
mpz_init (t);
mpz_2fac_ui (t, n);
sn = n / 2 + 1;
- } else
+ } else {
mpz_2fac_ui (x, n);
+ return;
+ }
}
} else { /* m >= 3, gcd(n,m) = 1 */
mp_limb_t *factors;
diff -r 6daa4e5ce87e -r a6ee205d1547 tests/mpz/t-gcd.c
--- a/tests/mpz/t-gcd.c Wed May 02 12:36:58 2012 +0200
+++ b/tests/mpz/t-gcd.c Wed May 02 14:30:57 2012 +0200
@@ -130,7 +130,7 @@
mpz_init (t);
/* Testcase to exercise the u0 == u1 case in mpn_gcdext_lehmer_n. */
- mpz_set_ui (op2, GMP_NUMB_MAX);
+ mpz_set_ui (op2, GMP_NUMB_MAX); /* FIXME: Huge limb doesn't always fit */
mpz_mul_2exp (op1, op2, 100);
mpz_add (op1, op1, op2);
mpz_mul_ui (op2, op2, 2);
More information about the gmp-commit
mailing list