Skip to content

Commit

Permalink
remove all references to GMP_IEEE_FLOATS , thats the only type we sup…
Browse files Browse the repository at this point in the history
…port anyway
  • Loading branch information
jasonmoxham committed Sep 11, 2011
1 parent d09a1e4 commit c0f5368
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 56 deletions.
10 changes: 1 addition & 9 deletions extract-dbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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;
Expand Down
7 changes: 1 addition & 6 deletions gmp-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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; \
Expand All @@ -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.
Expand Down
21 changes: 2 additions & 19 deletions mpn/generic/get_d.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
8 changes: 0 additions & 8 deletions tests/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}


Expand All @@ -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
}


Expand Down
14 changes: 0 additions & 14 deletions tests/mpn/t-get_d.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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++)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c0f5368

Please sign in to comment.