summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2015-10-29 12:29:44 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2015-10-29 12:29:44 +0000
commitb9028a17d0ab8d523f44f771e18f67f14d8effb7 (patch)
tree9cfa2a6a1513da3b7e7bd2f0e5af3a882bb21d7e
parenta32fcfd5927d45929a27bd91348765e296b2b55e (diff)
downloadmpfr-b9028a17d0ab8d523f44f771e18f67f14d8effb7.tar.gz
more tests do work with mini-gmp (from GMP 6.1.0-rc1)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@9708 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--src/mpfr-mini-gmp.c8
-rw-r--r--src/mpfr-mini-gmp.h2
-rw-r--r--tests/tabort_defalloc1.c2
-rw-r--r--tests/tabort_defalloc2.c2
-rw-r--r--tests/terandom_chisq.c12
-rw-r--r--tests/tnrandom_chisq.c12
-rw-r--r--tests/trandom_deviate.c11
7 files changed, 8 insertions, 41 deletions
diff --git a/src/mpfr-mini-gmp.c b/src/mpfr-mini-gmp.c
index e8ae8fe58..e7e319832 100644
--- a/src/mpfr-mini-gmp.c
+++ b/src/mpfr-mini-gmp.c
@@ -66,7 +66,7 @@ mpn_neg (mp_limb_t *rp, const mp_limb_t *sp, mp_size_t n)
#endif
#ifdef WANT_mpn_com
-mp_limb_t
+void
mpn_com (mp_limb_t *rp, const mp_limb_t *sp, mp_size_t n)
{
mp_size_t i;
@@ -118,10 +118,12 @@ mpn_divrem_1 (mp_limb_t *qp, mp_size_t qxn, mp_limb_t *np, mp_size_t nn,
static mp_limb_t
random_limb (void)
{
+ /* lrand48() only gives 31 bits */
#if GMP_NUMB_BITS == 32
- return lrand48 ();
+ return lrand48 () + (lrand48 () << 31);
#else
- return (((mp_limb_t) lrand48 ()) << 32) + lrand48 ();
+ return lrand48 () + (((mp_limb_t) lrand48 ()) << 31)
+ + (((mp_limb_t) lrand48 ()) << 62);
#endif
}
diff --git a/src/mpfr-mini-gmp.h b/src/mpfr-mini-gmp.h
index 388039b7a..7025cadcd 100644
--- a/src/mpfr-mini-gmp.h
+++ b/src/mpfr-mini-gmp.h
@@ -64,7 +64,7 @@ mp_limb_t mpn_neg (mp_limb_t *rp, const mp_limb_t *sp, mp_size_t n);
#ifndef mpn_com
#define WANT_mpn_com
-mp_limb_t mpn_com (mp_limb_t *rp, const mp_limb_t *sp, mp_size_t n);
+void mpn_com (mp_limb_t *rp, const mp_limb_t *sp, mp_size_t n);
#endif
#ifndef mpz_perfect_square_p
diff --git a/tests/tabort_defalloc1.c b/tests/tabort_defalloc1.c
index bac387615..2b395643e 100644
--- a/tests/tabort_defalloc1.c
+++ b/tests/tabort_defalloc1.c
@@ -30,7 +30,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
* the error before GMP can do the abort.
*/
-#if !defined(MPFR_USE_MINI_GMP) && !defined(__SANITIZE_ADDRESS__)
+#if !defined(__SANITIZE_ADDRESS__)
int
main (int argc, char **argv)
diff --git a/tests/tabort_defalloc2.c b/tests/tabort_defalloc2.c
index 1b5eccba7..e1f088d75 100644
--- a/tests/tabort_defalloc2.c
+++ b/tests/tabort_defalloc2.c
@@ -30,7 +30,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
* the error before GMP can do the abort.
*/
-#if !defined(MPFR_USE_MINI_GMP) && !defined(__SANITIZE_ADDRESS__)
+#if !defined(__SANITIZE_ADDRESS__)
int
main (int argc, char **argv)
diff --git a/tests/terandom_chisq.c b/tests/terandom_chisq.c
index 607ee7d43..30498a0d6 100644
--- a/tests/terandom_chisq.c
+++ b/tests/terandom_chisq.c
@@ -22,8 +22,6 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include "mpfr-test.h"
-#ifndef MPFR_USE_MINI_GMP
-
/* Return Phi(x) = 1 - exp(-x), the cumulative probability function for the
* exponential distribution. We only take differences of this function so the
* offset doesn't matter; here Phi(0) = 0. */
@@ -358,13 +356,3 @@ main (int argc, char *argv[])
tests_end_mpfr ();
return 0;
}
-
-#else
-
-int
-main (void)
-{
- return 77;
-}
-
-#endif
diff --git a/tests/tnrandom_chisq.c b/tests/tnrandom_chisq.c
index 9f7947c4b..2caba9561 100644
--- a/tests/tnrandom_chisq.c
+++ b/tests/tnrandom_chisq.c
@@ -22,8 +22,6 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include "mpfr-test.h"
-#ifndef MPFR_USE_MINI_GMP
-
/* Return Phi(x) = erf(x / sqrt(2)) / 2, the cumulative probability function
* for the normal distribution. We only take differences of this function so
* the offset doesn't matter; here Phi(0) = 0. */
@@ -359,13 +357,3 @@ main (int argc, char *argv[])
tests_end_mpfr ();
return 0;
}
-
-#else
-
-int
-main (void)
-{
- return 77;
-}
-
-#endif
diff --git a/tests/trandom_deviate.c b/tests/trandom_deviate.c
index 1bce7609a..234f4df54 100644
--- a/tests/trandom_deviate.c
+++ b/tests/trandom_deviate.c
@@ -22,7 +22,6 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include "mpfr-test.h"
-#ifndef MPFR_USE_MINI_GMP
#include "random_deviate.h"
#define W 32 /* Must match value in random_deviate.c */
@@ -325,13 +324,3 @@ main (int argc, char *argv[])
tests_end_mpfr ();
return 0;
}
-
-#else
-
-int
-main (void)
-{
- return 77;
-}
-
-#endif