Fix endian test functionality
authorMark Abraham <mark.j.abraham@gmail.com>
Wed, 6 Jun 2012 10:15:58 +0000 (20:15 +1000)
committerMark Abraham <mark.j.abraham@gmail.com>
Wed, 6 Jun 2012 12:40:32 +0000 (22:40 +1000)
Code for big-endian systems was silently failing with CMake. This
patch brings CMake and autotools into agreement.

Partial fix of #944
Change-Id: I1f14938fd23e926e05397977963fbf968f0406e0

src/gmxlib/maths.c

index 81e49aae4a86685c5854b2fd51eadb69f551c32b..41dce38c31f9ca3273bd6bc1b99a0cf49fa43027 100644 (file)
@@ -195,7 +195,9 @@ double gmx_erf(double x)
     
     conv.d=x;
     
-#ifdef IEEE754_BIG_ENDIAN_WORD_ORDER  
+        /* In release-4-6 and later branches, only the test for
+         * GMX_IEEE754_BIG_ENDIAN_WORD_ORDER will be required. */
+#if defined(IEEE754_BIG_ENDIAN_WORD_ORDER) || defined(GMX_IEEE754_BIG_ENDIAN_WORD_ORDER)
     hx=conv.i[0];
 #else
     hx=conv.i[1];
@@ -255,7 +257,9 @@ double gmx_erf(double x)
 
     conv.d = x;
 
-#ifdef IEEE754_BIG_ENDIAN_WORD_ORDER  
+        /* In release-4-6 and later branches, only the test for
+         * GMX_IEEE754_BIG_ENDIAN_WORD_ORDER will be required. */
+#if defined(IEEE754_BIG_ENDIAN_WORD_ORDER) || defined(GMX_IEEE754_BIG_ENDIAN_WORD_ORDER)
     conv.i[1] = 0;
 #else
     conv.i[0] = 0;
@@ -285,7 +289,9 @@ double gmx_erfc(double x)
     
     conv.d = x;
     
-#ifdef IEEE754_BIG_ENDIAN_WORD_ORDER  
+        /* In release-4-6 and later branches, only the test for
+         * GMX_IEEE754_BIG_ENDIAN_WORD_ORDER will be required. */
+#if defined(IEEE754_BIG_ENDIAN_WORD_ORDER) || defined(GMX_IEEE754_BIG_ENDIAN_WORD_ORDER)
     hx=conv.i[0];
 #else
     hx=conv.i[1];
@@ -356,7 +362,9 @@ double gmx_erfc(double x)
 
         conv.d = x;
 
-#ifdef IEEE754_BIG_ENDIAN_WORD_ORDER  
+        /* In release-4-6 and later branches, only the test for
+         * GMX_IEEE754_BIG_ENDIAN_WORD_ORDER will be required. */
+#if defined(IEEE754_BIG_ENDIAN_WORD_ORDER) || defined(GMX_IEEE754_BIG_ENDIAN_WORD_ORDER)
         conv.i[1] = 0;
 #else
         conv.i[0] = 0;