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

mercurial at gmplib.org mercurial at gmplib.org
Sun Jan 20 11:32:06 CET 2013


details:   /var/hg/gmp/rev/c9639e670780
changeset: 15325:c9639e670780
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Jan 20 11:31:51 2013 +0100
description:
Back out last change which left `divisor_size' uninitialised; achieve change's aim with a parameter tweak.

details:   /var/hg/gmp/rev/84d65b1cfd0e
changeset: 15326:84d65b1cfd0e
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sun Jan 20 11:32:02 2013 +0100
description:
ChangeLog

diffstat:

 ChangeLog            |   9 +++++++--
 tests/mpz/t-remove.c |  19 ++++++++-----------
 2 files changed, 15 insertions(+), 13 deletions(-)

diffs (48 lines):

diff -r 1277bdc8c937 -r 84d65b1cfd0e ChangeLog
--- a/ChangeLog	Sun Jan 20 08:03:55 2013 +0100
+++ b/ChangeLog	Sun Jan 20 11:32:02 2013 +0100
@@ -1,7 +1,12 @@
+2013-01-20  TG  <tege at gmplib.org>
+
+	* tests/mpz/t-remove.c: Back out last change which left `divisor_size'
+	uninitialised; achieve change's aim with a parameter tweak.
+
 2013-01-20 Marco Bodrato <bodrato at mail.dm.unipi.it>
 
-	* mini-gmp/tests/testutils.c (testhalves): New function, test
-	default memory functions.	
+	* mini-gmp/tests/testutils.c (testhalves): New function, test default
+	memory functions.
 	* mini-gmp/tests/testutils.h (testhalves): Declare it
 	* mini-gmp/tests/t-logops.c: Use testhalves.
 
diff -r 1277bdc8c937 -r 84d65b1cfd0e tests/mpz/t-remove.c
--- a/tests/mpz/t-remove.c	Sun Jan 20 08:03:55 2013 +0100
+++ b/tests/mpz/t-remove.c	Sun Jan 20 11:32:02 2013 +0100
@@ -52,18 +52,15 @@
   for (i = 0; i < reps; i++)
     {
       mpz_urandomb (bs, rands, 32);
-      size_range = mpz_get_ui (bs) % 17 + 2; /* 0..524288 bit operands */
+      size_range = mpz_get_ui (bs) % 18 + 1; /* 1..524288 bit operands */
 
-      if (i == 0)
-	mpz_set_ui (divisor, 1);
-      else
-	do
-	  {
-	    mpz_urandomb (bs, rands, size_range);
-	    divisor_size = mpz_get_ui (bs);
-	    mpz_rrandomb (divisor, rands, divisor_size);
-	  }
-	while (mpz_cmp_ui (divisor, 1) <= 0);
+      do
+	{
+	  mpz_urandomb (bs, rands, size_range);
+	  divisor_size = mpz_get_ui (bs);
+	  mpz_rrandomb (divisor, rands, divisor_size);
+	}
+      while (mpz_sgn (divisor) == 0);
 
       mpz_urandomb (bs, rands, size_range);
       dividend_size = mpz_get_ui (bs) + divisor_size;


More information about the gmp-commit mailing list