When NumPy is built, information about system configuration isrecorded, and is made available for extension modules using NumPy’s CAPI. These are mostly defined innumpyconfig.h (included inndarrayobject.h). The public symbols are prefixed byNPY_*.NumPy also offers some functions for querying information about theplatform in use.
For private use, NumPy also constructs aconfig.h in the NumPyinclude directory, which is not exported by NumPy (that is a pythonextension which use the numpy C API will not see those symbols), toavoid namespace pollution.
TheNPY_SIZEOF_{CTYPE} constants are defined so that sizeofinformation is available to the pre-processor.
NPY_SIZEOF_SHORT¶NPY_SIZEOF_INT¶NPY_SIZEOF_LONG¶NPY_SIZEOF_LONGLONG¶sizeof(longlong) where longlong is defined appropriately on theplatform.
NPY_SIZEOF_PY_LONG_LONG¶NPY_SIZEOF_FLOAT¶NPY_SIZEOF_DOUBLE¶NPY_SIZEOF_LONG_DOUBLE¶NPY_SIZEOF_PY_INTPTR_T¶Size of a pointer on this platform (sizeof(void *)) (A macro definesNPY_SIZEOF_INTP as well.)
NPY_CPU_X86¶NPY_CPU_AMD64¶NPY_CPU_IA64¶NPY_CPU_PPC¶NPY_CPU_PPC64¶NPY_CPU_SPARC¶NPY_CPU_SPARC64¶NPY_CPU_S390¶NPY_CPU_PARISC¶New in version 1.3.0.
CPU architecture of the platform; only one of the above isdefined.
Defined innumpy/npy_cpu.h
NPY_LITTLE_ENDIAN¶NPY_BIG_ENDIAN¶NPY_BYTE_ORDER¶New in version 1.3.0.
Portable alternatives to theendian.h macros of GNU Libc.If big endian,NPY_BYTE_ORDER ==NPY_BIG_ENDIAN, andsimilarly for little endian architectures.
Defined innumpy/npy_endian.h.
PyArray_GetEndianness()¶New in version 1.3.0.
Returns the endianness of the current platform.One ofNPY_CPU_BIG,NPY_CPU_LITTLE,orNPY_CPU_UNKNOWN_ENDIAN.