numpy
2.0.0
|
00001 #ifndef _NPY_ENDIAN_H_ 00002 #define _NPY_ENDIAN_H_ 00003 00004 /* 00005 * NPY_BYTE_ORDER is set to the same value as BYTE_ORDER set by glibc in 00006 * endian.h 00007 */ 00008 00009 #ifdef NPY_HAVE_ENDIAN_H 00010 /* Use endian.h if available */ 00011 #include <endian.h> 00012 00013 #define NPY_BYTE_ORDER __BYTE_ORDER 00014 #define NPY_LITTLE_ENDIAN __LITTLE_ENDIAN 00015 #define NPY_BIG_ENDIAN __BIG_ENDIAN 00016 #else 00017 /* Set endianness info using target CPU */ 00018 #include "npy_cpu.h" 00019 00020 #define NPY_LITTLE_ENDIAN 1234 00021 #define NPY_BIG_ENDIAN 4321 00022 00023 #if defined(NPY_CPU_X86) \ 00024 || defined(NPY_CPU_AMD64) \ 00025 || defined(NPY_CPU_IA64) \ 00026 || defined(NPY_CPU_ALPHA) \ 00027 || defined(NPY_CPU_ARMEL) \ 00028 || defined(NPY_CPU_SH_LE) \ 00029 || defined(NPY_CPU_MIPSEL) 00030 #define NPY_BYTE_ORDER NPY_LITTLE_ENDIAN 00031 #elif defined(NPY_CPU_PPC) \ 00032 || defined(NPY_CPU_SPARC) \ 00033 || defined(NPY_CPU_S390) \ 00034 || defined(NPY_CPU_HPPA) \ 00035 || defined(NPY_CPU_PPC64) \ 00036 || defined(NPY_CPU_ARMEB) \ 00037 || defined(NPY_CPU_SH_BE) \ 00038 || defined(NPY_CPU_MIPSEB) 00039 #define NPY_BYTE_ORDER NPY_BIG_ENDIAN 00040 #else 00041 #error Unknown CPU: can not set endianness 00042 #endif 00043 #endif 00044 00045 #endif