[Numpy-svn] r6107 - branches/dynamic_cpu_configuration/numpy/core/include/numpy

numpy-svn@scip... numpy-svn@scip...
Tue Nov 25 07:57:57 CST 2008


Author: cdavid
Date: 2008-11-25 07:57:49 -0600 (Tue, 25 Nov 2008)
New Revision: 6107

Modified:
   branches/dynamic_cpu_configuration/numpy/core/include/numpy/ndarrayobject.h
Log:
Use npy_endian.h to detect endianness of CPU.

We avoid using WORDS_ENDIAN (as set by python headers themselves)
because its value is set at python build time, and hence does not work
for situations like fat  builds on Mac OS X: if the fat binary is built
on PPC, WORDS_ENDIAN is defined to 1 in python headers, even on Intel.
Instead, we use npy_endian.h, which is not set at numpy build time, but
set everytime npy_endian.h is included (using cpu-specific macro).

Modified: branches/dynamic_cpu_configuration/numpy/core/include/numpy/ndarrayobject.h
===================================================================
--- branches/dynamic_cpu_configuration/numpy/core/include/numpy/ndarrayobject.h	2008-11-25 13:57:30 UTC (rev 6106)
+++ branches/dynamic_cpu_configuration/numpy/core/include/numpy/ndarrayobject.h	2008-11-25 13:57:49 UTC (rev 6107)
@@ -16,6 +16,8 @@
 /* This is auto-generated by the installer */
 #include "numpyconfig.h"
 
+#include "npy_endian.h"
+
 /* Only use thread if configured in config and python supports it */
 #if defined WITH_THREAD && !NPY_NO_SMP
         #define NPY_ALLOW_THREADS 1
@@ -1793,7 +1795,7 @@
 #define NPY_SWAP 's'
 #define NPY_IGNORE '|'
 
-#ifdef WORDS_BIGENDIAN
+#ifdef NPY_BIG_ENDIAN
 #define NPY_NATBYTE NPY_BIG
 #define NPY_OPPBYTE NPY_LITTLE
 #else



More information about the Numpy-svn mailing list