summaryrefslogtreecommitdiff
path: root/rts/StgPrimFloat.c
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2006-11-20 12:13:09 +0000
committerIan Lynagh <igloo@earth.li>2006-11-20 12:13:09 +0000
commit51f782f416a8aa05153a9f2dcef34d8bcb79f1ed (patch)
tree93bf4394964baa31b23e75cabf8678d0a9d3a6a5 /rts/StgPrimFloat.c
parentd9dff2f709009b8bca9c30ac650a634df0457ae5 (diff)
downloadhaskell-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.c17
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;
};