From c0f53686c51af2229eb4621a6b0788809a46e9df Mon Sep 17 00:00:00 2001 From: jasonmoxham Date: Sun, 11 Sep 2011 19:04:40 +0000 Subject: [PATCH] remove all references to GMP_IEEE_FLOATS , thats the only type we support anyway --- extract-dbl.c | 10 +--------- gmp-impl.h | 7 +------ mpn/generic/get_d.c | 21 ++------------------- tests/misc.c | 8 -------- tests/mpn/t-get_d.c | 14 -------------- 5 files changed, 4 insertions(+), 56 deletions(-) diff --git a/extract-dbl.c b/extract-dbl.c index 8e5e4b52..5f987ca5 100644 --- a/extract-dbl.c +++ b/extract-dbl.c @@ -22,14 +22,6 @@ MA 02110-1301, USA. */ #include "mpir.h" #include "gmp-impl.h" -#ifdef XDEBUG -#undef _GMP_IEEE_FLOATS -#endif - -#ifndef _GMP_IEEE_FLOATS -#define _GMP_IEEE_FLOATS 0 -#endif - #define BITS_IN_MANTISSA 53 /* Extract a non-negative double in d. */ @@ -63,7 +55,7 @@ __gmp_extract_double (mp_ptr rp, double d) return 0; } -#if _GMP_IEEE_FLOATS +#if 1 { union ieee_double_extract x; x.d = d; diff --git a/gmp-impl.h b/gmp-impl.h index 060ab620..62711fc4 100644 --- a/gmp-impl.h +++ b/gmp-impl.h @@ -3069,7 +3069,7 @@ typedef mp_limb_t UWtype; typedef unsigned int UHWtype; #define W_TYPE_SIZE BITS_PER_MP_LIMB -/* Define ieee_double_extract and _GMP_IEEE_FLOATS. +/* Define ieee_double_extract Bit field packing is "implementation defined" according to C99, which leaves us at the compiler's mercy here. For some systems packing is @@ -3082,7 +3082,6 @@ typedef unsigned int UHWtype; strange system that did anything else. */ #if HAVE_DOUBLE_IEEE_LITTLE_SWAPPED -#define _GMP_IEEE_FLOATS 1 union ieee_double_extract { struct @@ -3097,7 +3096,6 @@ union ieee_double_extract #endif #if HAVE_DOUBLE_IEEE_LITTLE_ENDIAN -#define _GMP_IEEE_FLOATS 1 union ieee_double_extract { struct @@ -3112,7 +3110,6 @@ union ieee_double_extract #endif #if HAVE_DOUBLE_IEEE_BIG_ENDIAN -#define _GMP_IEEE_FLOATS 1 union ieee_double_extract { struct @@ -3144,7 +3141,6 @@ __GMP_DECLSPEC double mpn_get_d __GMP_PROTO ((mp_srcptr, mp_size_t, mp_size_t, l a_inf if x is an infinity. Both are considered unlikely values, for branch prediction. */ -#if _GMP_IEEE_FLOATS #define DOUBLE_NAN_INF_ACTION(x, a_nan, a_inf) \ do { \ union ieee_double_extract u; \ @@ -3157,7 +3153,6 @@ __GMP_DECLSPEC double mpn_get_d __GMP_PROTO ((mp_srcptr, mp_size_t, mp_size_t, l { a_nan; } \ } \ } while (0) -#endif #ifndef DOUBLE_NAN_INF_ACTION /* Unknown format, try something generic. diff --git a/mpn/generic/get_d.c b/mpn/generic/get_d.c index 6531b175..9fcd166b 100644 --- a/mpn/generic/get_d.c +++ b/mpn/generic/get_d.c @@ -27,22 +27,6 @@ MA 02110-1301, USA. */ #include "gmp-impl.h" #include "longlong.h" -#ifndef _GMP_IEEE_FLOATS -#define _GMP_IEEE_FLOATS 0 -#endif - -#if ! _GMP_IEEE_FLOATS -/* dummy definition, just to let dead code compile */ -union ieee_double_extract { - struct { - int manh, manl, sig, exp; - } s; - double d; -}; -#endif - -/* To force use of the generic C code for testing, put - "#define _GMP_IEEE_FLOATS 0" at this point. */ #define CONST_1024 (1024) #define CONST_NEG_1023 (-1023) @@ -123,8 +107,7 @@ mpn_get_d (mp_srcptr ptr, mp_size_t size, mp_size_t sign, long exp) if (UNLIKELY ((unsigned long) (GMP_NUMB_BITS * size) > (unsigned long) (LONG_MAX - exp))) { - if (_GMP_IEEE_FLOATS) - goto ieee_infinity; + goto ieee_infinity; /* generic */ exp = LONG_MAX; @@ -137,7 +120,7 @@ mpn_get_d (mp_srcptr ptr, mp_size_t size, mp_size_t sign, long exp) #define ONE_LIMB (GMP_LIMB_BITS == 64 && 2*GMP_NUMB_BITS >= 53) #define TWO_LIMBS (GMP_LIMB_BITS == 32 && 3*GMP_NUMB_BITS >= 53) - if (_GMP_IEEE_FLOATS && (ONE_LIMB || TWO_LIMBS)) + if (ONE_LIMB || TWO_LIMBS) { union ieee_double_extract u; mp_limb_t m0, m1, m2, rmask; diff --git a/tests/misc.c b/tests/misc.c index f056f663..496b88d0 100644 --- a/tests/misc.c +++ b/tests/misc.c @@ -445,16 +445,12 @@ call_rand_algs (void (*func) __GMP_PROTO ((const char *, gmp_randstate_ptr))) double tests_infinity_d (void) { -#if _GMP_IEEE_FLOATS union ieee_double_extract x; x.s.exp = 2047; x.s.manl = 0; x.s.manh = 0; x.s.sig = 0; return x.d; -#else - return 0; -#endif } @@ -463,13 +459,9 @@ tests_infinity_d (void) int tests_isinf (double d) { -#if _GMP_IEEE_FLOATS union ieee_double_extract x; x.d = d; return (x.s.exp == 2047 && x.s.manl == 0 && x.s.manh == 0); -#else - return 0; -#endif } diff --git a/tests/mpn/t-get_d.c b/tests/mpn/t-get_d.c index 03e25c8d..34120af3 100644 --- a/tests/mpn/t-get_d.c +++ b/tests/mpn/t-get_d.c @@ -37,11 +37,6 @@ MA 02110-1301, USA. */ #include "tests.h" -#ifndef _GMP_IEEE_FLOATS -#define _GMP_IEEE_FLOATS 0 -#endif - - /* Exercise various 2^n values, with various exponents and positive and negative. */ void @@ -230,9 +225,6 @@ check_inf (void) double got; int exp_i; - if (! _GMP_IEEE_FLOATS) - return; - for (nsize = 1; nsize <= numberof (np); nsize++) { for (exp_i = 0; exp_i < numberof (exp_table); exp_i++) @@ -276,9 +268,6 @@ check_ieee_denorm (void) mp_size_t sign; double want, got; - if (! _GMP_IEEE_FLOATS) - return; - if (tests_setjmp_sigfpe() == 0) { exp = -1020; @@ -325,9 +314,6 @@ check_ieee_overflow (void) mp_size_t sign; double want, got; - if (! _GMP_IEEE_FLOATS) - return; - if (tests_setjmp_sigfpe() == 0) { exp = 1010;