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

mercurial at gmplib.org mercurial at gmplib.org
Tue Feb 5 10:49:04 CET 2013


details:   /var/hg/gmp/rev/27440345227c
changeset: 15378:27440345227c
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Tue Feb 05 10:48:51 2013 +0100
description:
Limit random dbits to avoid an infinite loop.

details:   /var/hg/gmp/rev/52470639dd75
changeset: 15379:52470639dd75
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Tue Feb 05 10:49:00 2013 +0100
description:
ChangeLog

diffstat:

 ChangeLog         |  4 ++++
 tests/mpn/t-div.c |  4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r bac75f914fcf -r 52470639dd75 ChangeLog
--- a/ChangeLog	Sun Feb 03 12:52:48 2013 +0100
+++ b/ChangeLog	Tue Feb 05 10:49:00 2013 +0100
@@ -1,3 +1,7 @@
+2013-02-05  Torbjorn Granlund  <tege at gmplib.org>
+
+	* tests/mpn/t-div.c: Limit random dbits to avoid an infinite loop.
+
 2013-02-03  Torbjorn Granlund  <tege at gmplib.org>
 
 	* tests/mpz/reuse.c: Fix typo causing the same negation condition to be
diff -r bac75f914fcf -r 52470639dd75 tests/mpn/t-div.c
--- a/tests/mpn/t-div.c	Sun Feb 03 12:52:48 2013 +0100
+++ b/tests/mpn/t-div.c	Tue Feb 05 10:49:00 2013 +0100
@@ -195,9 +195,9 @@
       nbits = random_word (rands) % (maxnbits - GMP_NUMB_BITS) + 2 * GMP_NUMB_BITS;
 
       if (test < 0)
-	dbits = (test + 300) % nbits + 1;
+	dbits = (test + 300) % (nbits - 1) + 1;
       else
-	dbits = random_word (rands) % nbits % maxdbits + 1;
+	dbits = random_word (rands) % (nbits - 1) % maxdbits + 1;
 
 #if RAND_UNIFORM
 #define RANDFUNC mpz_urandomb


More information about the gmp-commit mailing list