diff options
author | Ian Lynagh <igloo@earth.li> | 2006-11-20 12:13:09 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2006-11-20 12:13:09 +0000 |
commit | 51f782f416a8aa05153a9f2dcef34d8bcb79f1ed (patch) | |
tree | 93bf4394964baa31b23e75cabf8678d0a9d3a6a5 /rts/StgPrimFloat.c | |
parent | d9dff2f709009b8bca9c30ac650a634df0457ae5 (diff) | |
download | haskell-51f782f416a8aa05153a9f2dcef34d8bcb79f1ed.tar.gz |
Cope with big endian float word order on little endian machines
Diffstat (limited to 'rts/StgPrimFloat.c')
-rw-r--r-- | rts/StgPrimFloat.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/rts/StgPrimFloat.c b/rts/StgPrimFloat.c index 5bd6aebb1c..9521094887 100644 --- a/rts/StgPrimFloat.c +++ b/rts/StgPrimFloat.c @@ -48,7 +48,7 @@ #define FMSBIT 0x80000000 #endif -#ifdef WORDS_BIGENDIAN +#if defined(WORDS_BIGENDIAN) || defined(FLOAT_WORDS_BIGENDIAN) #define L 1 #define H 0 #else @@ -307,11 +307,18 @@ union stg_ieee754_dbl unsigned int mantissa0:20; unsigned int mantissa1:32; #else +#if FLOAT_WORDS_BIGENDIAN + unsigned int mantissa0:20; + unsigned int exponent:11; + unsigned int negative:1; + unsigned int mantissa1:32; +#else unsigned int mantissa1:32; unsigned int mantissa0:20; unsigned int exponent:11; unsigned int negative:1; #endif +#endif } ieee; /* This format makes it easier to see if a NaN is a signalling NaN. */ struct { @@ -323,12 +330,20 @@ union stg_ieee754_dbl unsigned int mantissa0:19; unsigned int mantissa1:32; #else +#if FLOAT_WORDS_BIGENDIAN + unsigned int mantissa0:19; + unsigned int quiet_nan:1; + unsigned int exponent:11; + unsigned int negative:1; + unsigned int mantissa1:32; +#else unsigned int mantissa1:32; unsigned int mantissa0:19; unsigned int quiet_nan:1; unsigned int exponent:11; unsigned int negative:1; #endif +#endif } ieee_nan; }; |