diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2014-01-20 17:44:03 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2014-01-20 17:44:03 +0000 |
commit | e1e6863b9cfa5ec581b9fd98f504449fbf57f065 (patch) | |
tree | be3da2f1e079284db5d22ad501dd244bf409003e /tests/mpfr-test.h | |
parent | 16355c3f99a43cafb9b0d2a27897c3d521a4832b (diff) | |
download | mpfr-e1e6863b9cfa5ec581b9fd98f504449fbf57f065.tar.gz |
MPFR now depends on GMP 4.2+ instead of 4.1+.
GMP 4.2 compatibility fixed.
Code clean-up.
(Modified patch from Patrick PĂ©lissier)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@8813 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/mpfr-test.h')
-rw-r--r-- | tests/mpfr-test.h | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/tests/mpfr-test.h b/tests/mpfr-test.h index dafe98df0..ee1014812 100644 --- a/tests/mpfr-test.h +++ b/tests/mpfr-test.h @@ -34,6 +34,10 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include "mpfr-impl.h" +#if defined (__cplusplus) +extern "C" { +#endif + /* generates a random long int, a random double, and corresponding seed initializing */ #define DBL_RAND() ((double) randlimb() / (double) MP_LIMB_T_MAX) @@ -70,10 +74,6 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #define FLIST mpfr_ptr, mpfr_srcptr, mpfr_rnd_t -#if defined (__cplusplus) -extern "C" { -#endif - void test_version _MPFR_PROTO ((void)); void tests_memory_start _MPFR_PROTO ((void)); @@ -113,10 +113,6 @@ int mpfr_cmp_str _MPFR_PROTO ((mpfr_srcptr x, const char *, int, mpfr_rnd_t)); #define mpfr_cmp0(x,y) (MPFR_ASSERTN (!MPFR_IS_NAN (x) && !MPFR_IS_NAN (y)), mpfr_cmp (x,y)) #define mpfr_cmp_ui0(x,i) (MPFR_ASSERTN (!MPFR_IS_NAN (x)), mpfr_cmp_ui (x,i)) -#if defined (__cplusplus) -} -#endif - /* define CHECK_EXTERNAL if you want to check mpfr against another library with correct rounding. You'll probably have to modify mpfr_print_raw() and/or test_add() below: @@ -179,4 +175,38 @@ mpfr_print_raw (mpfr_srcptr x) } #endif +/* Random */ +__MPFR_DECLSPEC extern char mpfr_rands_initialized; +__MPFR_DECLSPEC extern gmp_randstate_t mpfr_rands; + +#undef RANDS +#define RANDS \ + ((mpfr_rands_initialized ? 0 \ + : (mpfr_rands_initialized = 1, \ + gmp_randinit_default (mpfr_rands), 0)), \ + mpfr_rands) + +#undef RANDS_CLEAR +#define RANDS_CLEAR() \ + do { \ + if (mpfr_rands_initialized) \ + { \ + mpfr_rands_initialized = 0; \ + gmp_randclear (mpfr_rands); \ + } \ + } while (0) + +typedef __gmp_randstate_struct *gmp_randstate_ptr; + +/* Allocation */ +__MPFR_DECLSPEC void *mpfr_default_allocate _MPFR_PROTO ((size_t)); +__MPFR_DECLSPEC void *mpfr_default_reallocate _MPFR_PROTO ((void *, size_t, + size_t)); +__MPFR_DECLSPEC void mpfr_default_free _MPFR_PROTO ((void *, size_t)); + + +#if defined (__cplusplus) +} +#endif + #endif |