[Gmp-commit] /var/hg/gmp: 3 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Sat Jan 26 10:01:10 CET 2013


details:   /var/hg/gmp/rev/7a10c72364ed
changeset: 15356:7a10c72364ed
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sat Jan 26 09:59:52 2013 +0100
description:
Swap some lines to make it similar to mod_4.c.

details:   /var/hg/gmp/rev/6d11dc86efb7
changeset: 15357:6d11dc86efb7
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sat Jan 26 10:01:00 2013 +0100
description:
Test also mpn_mod_1s_3p.

details:   /var/hg/gmp/rev/d953d77ce081
changeset: 15358:d953d77ce081
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sat Jan 26 10:01:07 2013 +0100
description:
ChangeLog

diffstat:

 ChangeLog             |   4 ++++
 mpn/generic/mod_1_3.c |  17 ++++++++++-------
 tests/mpn/t-mod_1.c   |  13 ++++++++++++-
 3 files changed, 26 insertions(+), 8 deletions(-)

diffs (81 lines):

diff -r c723329b63f8 -r d953d77ce081 ChangeLog
--- a/ChangeLog	Sat Jan 26 09:49:06 2013 +0100
+++ b/ChangeLog	Sat Jan 26 10:01:07 2013 +0100
@@ -1,5 +1,9 @@
 2013-01-26  Torbjorn Granlund  <tege at gmplib.org>
 
+	* tests/mpn/t-mod_1.c: Test also mpn_mod_1s_3p.
+
+	* mpn/generic/mod_1_3.c: Swap some lines to make it similar to mod_4.c.
+
 	* tests/mpz/reuse.c: Fix typo in last change.
 
 2013-01-23 Marco Bodrato <bodrato at mail.dm.unipi.it>
diff -r c723329b63f8 -r d953d77ce081 mpn/generic/mod_1_3.c
--- a/mpn/generic/mod_1_3.c	Sat Jan 26 09:49:06 2013 +0100
+++ b/mpn/generic/mod_1_3.c	Sat Jan 26 10:01:07 2013 +0100
@@ -9,7 +9,7 @@
    SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES.  IN FACT, IT IS ALMOST
    GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
 
-Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2008, 2009, 2010, 2013 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -44,17 +44,20 @@
   b <<= cnt;
   invert_limb (bi, b);
 
+  cps[0] = bi;
+  cps[1] = cnt;
+
   B1modb = -b * ((bi >> (GMP_LIMB_BITS-cnt)) | (CNST_LIMB(1) << cnt));
   ASSERT (B1modb <= b);		/* NB: not fully reduced mod b */
+  cps[2] = B1modb >> cnt;
+
   udiv_rnnd_preinv (B2modb, B1modb, 0, b, bi);
+  cps[3] = B2modb >> cnt;
+
   udiv_rnnd_preinv (B3modb, B2modb, 0, b, bi);
+  cps[4] = B3modb >> cnt;
+
   udiv_rnnd_preinv (B4modb, B3modb, 0, b, bi);
-
-  cps[0] = bi;
-  cps[1] = cnt;
-  cps[2] = B1modb >> cnt;
-  cps[3] = B2modb >> cnt;
-  cps[4] = B3modb >> cnt;
   cps[5] = B4modb >> cnt;
 
 #if WANT_ASSERT
diff -r c723329b63f8 -r d953d77ce081 tests/mpn/t-mod_1.c
--- a/tests/mpn/t-mod_1.c	Sat Jan 26 09:49:06 2013 +0100
+++ b/tests/mpn/t-mod_1.c	Sat Jan 26 10:01:07 2013 +0100
@@ -1,6 +1,6 @@
 /* Test mpn_mod_1 variants.
 
-Copyright 2010 Free Software Foundation, Inc.
+Copyright 2010, 2013 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -52,6 +52,17 @@
 	  goto fail;
 	}
     }
+  if (b <= GMP_NUMB_MASK / 3)
+    {
+      mp_limb_t pre[6];
+      mpn_mod_1s_3p_cps (pre, b);
+      r = mpn_mod_1s_3p (ap, n, b << pre[1], pre);
+      if (r != r_ref)
+	{
+	  printf ("mpn_mod_1s_3p failed\n");
+	  goto fail;
+	}
+    }
   if (b <= GMP_NUMB_MASK / 4)
     {
       mp_limb_t pre[7];


More information about the gmp-commit mailing list