[Gmp-commit] /home/hgfiles/gmp: Avoid a division by zero.
mercurial at gmplib.org
mercurial at gmplib.org
Fri Dec 11 10:29:59 CET 2009
details: /home/hgfiles/gmp/rev/011d123ac389
changeset: 13031:011d123ac389
user: Torbjorn Granlund <tege at gmplib.org>
date: Fri Dec 11 10:29:47 2009 +0100
description:
Avoid a division by zero.
diffstat:
ChangeLog | 6 ++++--
tests/mpn/t-mulmod_bnm1.c | 4 ++--
2 files changed, 6 insertions(+), 4 deletions(-)
diffs (50 lines):
diff -r 6c173e67bc39 -r 011d123ac389 ChangeLog
--- a/ChangeLog Fri Dec 11 00:49:25 2009 +0100
+++ b/ChangeLog Fri Dec 11 10:29:47 2009 +0100
@@ -1,5 +1,7 @@
2009-12-11 Torbjorn Granlund <tege at gmplib.org>
+ * tests/mpn/t-mulmod_bnm1.c: Avoid a division by zero.
+
* configure.in: Set up different paths for different 64-bit sparc
processors.
* mpn/sparc64/ultrasparc34/gmp-mparam.h: New file.
@@ -78,7 +80,7 @@
* tune/speed.c (routine): Add mpn_invert.
- * tune/tuneup.c (tune_invert): New function.
+ * tune/tuneup.c (tune_invert): New function.
* tune/speed.h (SPEED_ROUTINE_MPN_INVERT): New macro.
* tune/common.c (speed_mpn_invert): New function.
* gmp-impl.h: Provide declarations for corresponding threshold var.
@@ -17957,7 +17959,7 @@
* mpn/powerpc32: Use dnl/C instead of `#' for comments.
* config.guess: Get "model" limit between pentium 2 and pentium3 right.
- Get rid of code determining `_' prefix; use double labels instead.
+ Get rid of code determining `_' prefix; use double labels instead.
* config.guess: Partially merge with FSF version of April 22.
(Don't bring over NetBSD changes for now.)
diff -r 6c173e67bc39 -r 011d123ac389 tests/mpn/t-mulmod_bnm1.c
--- a/tests/mpn/t-mulmod_bnm1.c Fri Dec 11 00:49:25 2009 +0100
+++ b/tests/mpn/t-mulmod_bnm1.c Fri Dec 11 10:29:47 2009 +0100
@@ -140,7 +140,7 @@
/* Second half of the tests are done using mulmod to compute a
full product and an >= bn > 0; recursion make it eventually
fall in the case above. */
- an = ((n+3) >> 2) + gmp_urandomm_ui (rands, n - (n >> 2));
+ an = ((n+3) >> 2) + gmp_urandomm_ui (rands, n - (n >> 2));
bn = 1 + ((an == 1) ? 0 : gmp_urandomm_ui (rands, an - 1));
}
@@ -152,7 +152,7 @@
mpn_random2 (bp, bn);
/* Sometime trigger the an = -1 or bn = -1 or an*bn == -1 Mod(B^{n/2}+1) */
- if ((test & 0x1f) == 1) {
+ if ((test & 0x1f) == 1 && n > 1) {
mp_size_t x;
MPN_COPY (ap, ap + (n >> 1), an - (n >> 1));
MPN_ZERO (ap + an - (n >> 1) , n - an);
More information about the gmp-commit
mailing list