[Pkg-haskell-commits] darcs: haskell-ieee754: Backport endianness detection fix from upstream (Closes: 774881) Thanks to Jurica Stanojkovic for preparing the patch.
Joachim Breitner
mail at joachim-breitner.de
Tue Feb 3 09:37:25 UTC 2015
Tue Feb 3 09:18:24 UTC 2015 Joachim Breitner <mail at joachim-breitner.de>
* Backport endianness detection fix from upstream (Closes: 774881) Thanks to Jurica Stanojkovic for preparing the patch.
M! ./changelog -9 +2
A! ./patches/
A! ./patches/series
A! ./patches/upstream-big-endian-support.diff
Tue Feb 3 09:18:24 UTC 2015 Joachim Breitner <mail at joachim-breitner.de>
* Backport endianness detection fix from upstream (Closes: 774881) Thanks to Jurica Stanojkovic for preparing the patch.
diff -rN -u old-haskell-ieee754/changelog new-haskell-ieee754/changelog
--- old-haskell-ieee754/changelog 2015-02-03 09:37:25.131951445 +0000
+++ new-haskell-ieee754/changelog 2015-02-03 09:37:25.139951442 +0000
@@ -1,10 +1,3 @@
-haskell-ieee754 (0.7.3-4) experimental; urgency=low
-
- * Adjust watch file to new hackage layout
- * Depend on haskell-devscripts 0.9, found in experimental
-
- -- Joachim Breitner <nomeata at debian.org> Sat, 20 Dec 2014 17:11:07 +0100
-
haskell-ieee754 (0.7.3-3) unstable; urgency=low
* Enable compat level 9
diff -rN -u old-haskell-ieee754/patches/series new-haskell-ieee754/patches/series
--- old-haskell-ieee754/patches/series 1970-01-01 00:00:00.000000000 +0000
+++ new-haskell-ieee754/patches/series 2015-02-03 09:37:25.139951442 +0000
@@ -0,0 +1 @@
+upstream-big-endian-support.diff
diff -rN -u old-haskell-ieee754/patches/upstream-big-endian-support.diff new-haskell-ieee754/patches/upstream-big-endian-support.diff
--- old-haskell-ieee754/patches/upstream-big-endian-support.diff 1970-01-01 00:00:00.000000000 +0000
+++ new-haskell-ieee754/patches/upstream-big-endian-support.diff 2015-02-03 09:37:25.139951442 +0000
@@ -0,0 +1,85 @@
+--- 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
More information about the Pkg-haskell-commits
mailing list