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

mercurial at gmplib.org mercurial at gmplib.org
Sun Jan 20 14:33:48 CET 2013


details:   /var/hg/gmp/rev/540a7e02d9ae
changeset: 15331:540a7e02d9ae
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Jan 20 14:31:32 2013 +0100
description:
(main): Make negative `test' index value mean divisor bits, for better small operands coverage.

details:   /var/hg/gmp/rev/a4acd2074820
changeset: 15332:a4acd2074820
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Jan 20 14:31:44 2013 +0100
description:
ChangeLog.

details:   /var/hg/gmp/rev/a3f46985b1e4
changeset: 15333:a3f46985b1e4
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Jan 20 14:33:39 2013 +0100
description:
(check-mini-gmp): Set also DYLD_LIBRARY_PATH for the benefit of Darwin.

diffstat:

 ChangeLog         |   2 ++
 Makefile.am       |   3 ++-
 tests/mpn/t-div.c |  26 +++++++++++---------------
 3 files changed, 15 insertions(+), 16 deletions(-)

diffs (101 lines):

diff -r e31e492faf3d -r a3f46985b1e4 ChangeLog
--- a/ChangeLog	Sun Jan 20 13:04:06 2013 +0100
+++ b/ChangeLog	Sun Jan 20 14:33:39 2013 +0100
@@ -3,6 +3,8 @@
 	* tests/mpn/t-div.c: Test mpn_sb_div_qr_sec and mpn_sb_div_r_sec.
 	(main): Separate divisor into normalised (dnp) and unnormalised (dup),
 	pass appropriate variant to each function.
+	(main): Make negative `test' index value mean divisor bits, for better
+	small operands coverage.
 
 	* tests/mpz/t-remove.c: Back out last change which left `divisor_size'
 	uninitialised; achieve change's aim with a parameter tweak.
diff -r e31e492faf3d -r a3f46985b1e4 Makefile.am
--- a/Makefile.am	Sun Jan 20 13:04:06 2013 +0100
+++ b/Makefile.am	Sun Jan 20 14:33:39 2013 +0100
@@ -2,7 +2,7 @@
 
 
 # Copyright 1991, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2006, 2007, 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
+# 2006, 2007, 2008, 2009, 2011, 2012, 2013 Free Software Foundation, Inc.
 #
 # This file is part of the GNU MP Library.
 #
@@ -407,6 +407,7 @@
 	$(MKDIR_P) mini-gmp/tests \
 	&& cd mini-gmp/tests \
 	&& LD_LIBRARY_PATH="../../.libs:$$LD_LIBRARY_PATH" \
+	&& DYLD_LIBRARY_PATH="../../.libs:$$DYLD_LIBRARY_PATH" \
 	   $(MAKE) -f "$$abs_srcdir/mini-gmp/tests/Makefile" \
 		VPATH="$$abs_srcdir/mini-gmp/tests" \
 		srcdir="$$abs_srcdir/mini-gmp/tests" \
diff -r e31e492faf3d -r a3f46985b1e4 tests/mpn/t-div.c
--- a/tests/mpn/t-div.c	Sun Jan 20 13:04:06 2013 +0100
+++ b/tests/mpn/t-div.c	Sun Jan 20 14:33:39 2013 +0100
@@ -54,7 +54,7 @@
   puts ("");
 }
 
-static unsigned long test;
+static signed long test;
 
 static void
 check_one (mp_ptr qp, mp_srcptr rp,
@@ -84,7 +84,7 @@
       tvalue = "Q*D";
     error:
       printf ("\r*******************************************************************************\n");
-      printf ("%s failed test %lu: %s\n", fname, test, msg);
+      printf ("%s failed test %ld: %s\n", fname, test, msg);
       printf ("N=    "); dumpy (np, nn);
       printf ("D=    "); dumpy (dp, dn);
       printf ("Q=    "); dumpy (qp, qn);
@@ -147,12 +147,11 @@
   mp_ptr np, dup, dnp, qp, rp;
   mp_limb_t t;
   gmp_pi1_t dinv;
-  int count = COUNT;
+  long count = COUNT;
   mp_ptr scratch;
   mp_limb_t ran;
   mp_size_t alloc, itch;
   mp_limb_t rran0, rran1, qran0, qran1;
-  mp_limb_t dh;
   TMP_DECL;
 
   if (argc > 1)
@@ -190,17 +189,14 @@
   alloc = 1;
   scratch = __GMP_ALLOCATE_FUNC_LIMBS (alloc);
 
-  for (test = 0; test < count;)
+  for (test = -300; test < count;)
     {
-      do
-	{
-	  nbits = random_word (rands) % (maxnbits - GMP_NUMB_BITS) + 2 * GMP_NUMB_BITS;
-	  if (maxdbits > nbits)
-	    dbits = random_word (rands) % nbits + 1;
-	  else
-	    dbits = random_word (rands) % maxdbits + 1;
-	}
-      while (nbits < dbits);
+      nbits = random_word (rands) % (maxnbits - GMP_NUMB_BITS) + 2 * GMP_NUMB_BITS;
+
+      if (test < 0)
+	dbits = (test + 300) % nbits + 1;
+      else
+	dbits = random_word (rands) % nbits % maxdbits + 1;
 
 #if RAND_UNIFORM
 #define RANDFUNC mpz_urandomb
@@ -214,7 +210,7 @@
       dn = SIZ (d);
       dup = PTR (d);
       MPN_COPY (dnp, dup, dn);
-     dnp[dn - 1] |= GMP_NUMB_HIGHBIT;
+      dnp[dn - 1] |= GMP_NUMB_HIGHBIT;
 
       if (test % 2 == 0)
 	{


More information about the gmp-commit mailing list