[Python-checkins] r71603 - in python/branches/py3k-short-float-repr: Python/dtoa.c configure

mark.dickinson python-checkins at python.org
Tue Apr 14 18:00:42 CEST 2009


Author: mark.dickinson
Date: Tue Apr 14 18:00:41 2009
New Revision: 71603

Log:
Fix endianness detection for universal builds on OS X.


Modified:
   python/branches/py3k-short-float-repr/Python/dtoa.c
   python/branches/py3k-short-float-repr/configure

Modified: python/branches/py3k-short-float-repr/Python/dtoa.c
==============================================================================
--- python/branches/py3k-short-float-repr/Python/dtoa.c	(original)
+++ python/branches/py3k-short-float-repr/Python/dtoa.c	Tue Apr 14 18:00:41 2009
@@ -112,12 +112,24 @@
 #define MALLOC PyMem_Malloc
 #define FREE PyMem_Free
 
-#ifdef DOUBLE_IS_LITTLE_ENDIAN_IEEE754
-#define IEEE_8087
-#endif
-
-#if defined(DOUBLE_IS_BIG_ENDIAN_IEEE754) || defined(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754)
-#define IEEE_MC68k
+/* For Apple universal PPC/Intel builds, the autoconf result will be reporting
+   the wrong endianness for one of the architectures.  Use a different
+   method for determining endianness of doubles.
+*/
+#if defined AC_APPLE_UNIVERSAL_BUILD
+#  if defined __BIG_ENDIAN__
+#    define IEEE_MC68k
+#  else
+#    define IEEE_8087
+#  endif
+#else
+#  ifdef DOUBLE_IS_LITTLE_ENDIAN_IEEE754
+#    define IEEE_8087
+#  endif
+#  if defined(DOUBLE_IS_BIG_ENDIAN_IEEE754) ||  \
+    defined(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754)
+#    define IEEE_MC68k
+#  endif
 #endif
 #if defined(IEEE_8087) + defined(IEEE_MC68k) != 1
 #error "Exactly one of IEEE_8087 or IEEE_MC68k should be defined."

Modified: python/branches/py3k-short-float-repr/configure
==============================================================================
--- python/branches/py3k-short-float-repr/configure	(original)
+++ python/branches/py3k-short-float-repr/configure	Tue Apr 14 18:00:41 2009
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 71576 .
+# From configure.in Revision: 71602 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for python 3.1.
 #


More information about the Python-checkins mailing list