Hi,

I would like to have this fixed in jessie, If possible.
Back-ported upstream patch is attached (with comments from upstream source).

Please include proposed patch.
Thank you!

Regards,
Jurica
--- haskell-ieee754-0.7.3.orig/cbits/feqrel_source.c
+++ haskell-ieee754-0.7.3/cbits/feqrel_source.c
@@ -1,6 +1,42 @@
 /* adapted from Tango version 0.99.9, BSD Licensed
  */
 
+/* Endianness detection taken from http://esr.ibiblio.org/?p=5095 .
+*
+* We are assuming that the endianness is the same for integers and floats;
+* this is true for modern systems but false in a few historical machines and
+* some old ARM processors; see
+* http://en.wikipedia.org/wiki/Endianness#Floating-point_and_endianness .
+*/
+
+/*
+__BIG_ENDIAN__ and __LITTLE_ENDIAN__ are defined in some gcc versions
+only, probably depending on the architecture. Try to use endian.h if
+the gcc way fails - endian.h also does not seem to be available on all
+platforms.
+*/
+#ifdef __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+#else /* __BIG_ENDIAN__ */
+# ifdef __LITTLE_ENDIAN__
+#   undef WORDS_BIGENDIAN
+# else
+#   ifdef BSD
+#     include <sys/endian.h>
+#   else
+#     include <endian.h>
+#   endif
+#   if __BYTE_ORDER == __BIG_ENDIAN
+#     define WORDS_BIGENDIAN 1
+#   elif __BYTE_ORDER == __LITTLE_ENDIAN
+#     undef WORDS_BIGENDIAN
+#   else
+#     error "unable to determine endianess!"
+#   endif /* __BYTE_ORDER */
+# endif /* __LITTLE_ENDIAN__ */
+#endif /* __BIG_ENDIAN__ */
+
+
 /* REAL_EXPMASK is a ushort mask to select the exponent portion (without sign)
  * REAL_SIGNMASK is a ushort mask to select the sign bit.
  * REAL_EXPPOS_SHORT is the index of the exponent when represented as a uint16_t array.
@@ -16,7 +52,7 @@
 # define REAL_EXPBIAS            ((uint16_t) 0x3F00)
 # define REAL_EXPBIAS_INT32      ((uint32_t) 0x7F800000)
 # define REAL_MANTISSAMASK_INT32 ((uint32_t) 0x007FFFFF)
-# if BIG_ENDIAN == 1
+# if WORDS_BIGENDIAN
 #  define REAL_EXPPOS_INT16 0
 # else
 #  define REAL_EXPPOS_INT16 1
@@ -28,7 +64,7 @@
 # define REAL_EXPBIAS            ((uint16_t) 0x3FE0)
 # define REAL_EXPBIAS_INT32      ((uint32_t) 0x7FF00000)
 # define REAL_MANTISSAMASK_INT32 ((uint32_t) 0x000FFFFF); /* for the MSB only */
-# if BIG_ENDIAN == 1
+# if WORDS_BIGENDIAN
 #  define REAL_EXPPOS_INT16 0
 #  define REAL_SIGNPOS_BYTE 0
 # else
--- haskell-ieee754-0.7.3.orig/ieee754.cabal
+++ haskell-ieee754-0.7.3/ieee754.cabal
@@ -19,11 +19,6 @@ tested-with:     GHC ==6.12.3
 extra-source-files: LICENSE.Tango NEWS cbits/feqrel_source.c
                     tests/Makefile tests/Tests.hs
 
-flag big_endian
-  description: Build for a big endian machine.  Beware that only
-               little endian machines have been tested.
-  default:     False
-
 library
     exposed-modules: Data.AEq
                      Numeric.IEEE
@@ -39,7 +34,5 @@ library
                      cbits/double.c
 
     cc-options:      -Wall --std=c99
-    if flag(big_endian)
-        cc-options:  -DBIG_ENDIAN
 
     extra-libraries: m

Reply via email to