[Gmp-commit] /home/hgfiles/gmp: Use refmpn_mul for reference in test functions.

mercurial at gmplib.org mercurial at gmplib.org
Mon Dec 21 10:42:46 CET 2009


details:   /home/hgfiles/gmp/rev/2f399c54d948
changeset: 13151:2f399c54d948
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Mon Dec 21 10:42:38 2009 +0100
description:
Use refmpn_mul for reference in test functions.

diffstat:

 ChangeLog                 |   5 +++++
 tests/mpn/t-mulmod_bnm1.c |  10 +++-------
 tests/mpn/t-sqrmod_bnm1.c |   8 ++------
 3 files changed, 10 insertions(+), 13 deletions(-)

diffs (79 lines):

diff -r f19fcb8f29b3 -r 2f399c54d948 ChangeLog
--- a/ChangeLog	Mon Dec 21 00:33:09 2009 +0100
+++ b/ChangeLog	Mon Dec 21 10:42:38 2009 +0100
@@ -1,3 +1,8 @@
+2009-12-21  Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* tests/mpn/t-mulmod_bnm1.c (ref_mulmod_bnm1): Use ref_mul.
+	* tests/mpn/t-sqrmod_bnm1.c (ref_sqrmod_bnm1): Likewise.
+
 2009-12-20  Marco Bodrato <bodrato at mail.dm.unipi.it>
 
 	* mpn/generic/mulmod_bnm1.c (mpn_mulmod_bnm1): New CRT.
diff -r f19fcb8f29b3 -r 2f399c54d948 tests/mpn/t-mulmod_bnm1.c
--- a/tests/mpn/t-mulmod_bnm1.c	Mon Dec 21 00:33:09 2009 +0100
+++ b/tests/mpn/t-mulmod_bnm1.c	Mon Dec 21 10:42:38 2009 +0100
@@ -29,7 +29,7 @@
 
 /* Sizes are up to 2^SIZE_LOG limbs */
 #ifndef SIZE_LOG
-#define SIZE_LOG 12
+#define SIZE_LOG 11
 #endif
 
 #ifndef COUNT
@@ -47,10 +47,6 @@
   B^rn-1. This should not be a problem if mulmod_bnm1 is used to
   combine results and obtain a natural number when one knows in
   advance that the final value is less than (B^rn-1).
-
-  WARNING: This function uses mpn_mul internally. If a release of GMP
-  will ever use mpn_mulmod_bnm1 to obtain full products, then this
-  reference must be changed.
 */
 
 static void
@@ -62,9 +58,9 @@
   ASSERT (0 < bn && bn <= rn);
 
   if (an >= bn)
-    mpn_mul (rp, ap, an, bp, bn);
+    refmpn_mul (rp, ap, an, bp, bn);
   else
-    mpn_mul (rp, bp, bn, ap, an);
+    refmpn_mul (rp, bp, bn, ap, an);
   an += bn;
   if( UNLIKELY(an <= rn) )
     MPN_ZERO (rp + an, rn - an);
diff -r f19fcb8f29b3 -r 2f399c54d948 tests/mpn/t-sqrmod_bnm1.c
--- a/tests/mpn/t-sqrmod_bnm1.c	Mon Dec 21 00:33:09 2009 +0100
+++ b/tests/mpn/t-sqrmod_bnm1.c	Mon Dec 21 10:42:38 2009 +0100
@@ -33,7 +33,7 @@
 #endif
 
 #ifndef COUNT
-#define COUNT 5000
+#define COUNT 3000
 #endif
 
 #define MAX_N (1L << SIZE_LOG)
@@ -47,10 +47,6 @@
   B^rn-1. This should not be a problem if sqrmod_bnm1 is used to
   combine results and obtain a natural number when one knows in
   advance that the final value is less than (B^rn-1).
-
-  WARNING: This function uses mpn_mul internally. If a release of GMP
-  will ever use mpn_sqrmod_bnm1 to obtain full products, then this
-  reference must be changed.
 */
 
 static void
@@ -60,7 +56,7 @@
 
   ASSERT (0 < an && an <= rn);
 
-  mpn_sqr_n (rp, ap, an);
+  refmpn_mul (rp, ap, an, ap, an);
   an *= 2;
   if( UNLIKELY(an <= rn) )
     MPN_ZERO (rp + an, rn - an);


More information about the gmp-commit mailing list