From af9e54158cdfe9d779da709f423bbc2e331bf1da Mon Sep 17 00:00:00 2001 From: David Cournapeau Date: Tue, 25 Nov 2008 13:56:49 +0000 Subject: Add a (public) header to detect common CPU archs. --- numpy/core/include/numpy/cpuarch.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 numpy/core/include/numpy/cpuarch.h (limited to 'numpy') diff --git a/numpy/core/include/numpy/cpuarch.h b/numpy/core/include/numpy/cpuarch.h new file mode 100644 index 000000000..5d15a9dc4 --- /dev/null +++ b/numpy/core/include/numpy/cpuarch.h @@ -0,0 +1,32 @@ +/* + * This set (target) cpu specific macros: + * - NPY_TARGET_CPU: target CPU type + */ +#ifndef _NPY_CPUARCH_H_ +#define _NPY_CPUARCH_H_ + +#if defined ( _i386_ ) || defined( __i386__ ) + /* __i386__ is defined by gcc and Intel compiler on Linux, _i386_ by + VS compiler */ + #define NPY_TARGET_CPU NPY_X86 +#elif defined(__x86_64__) || defined(__amd64__) + /* both __x86_64__ and __amd64__ are defined by gcc */ + #define NPY_TARGET_CPU NPY_AMD64 +#elif defined(__ppc__) || defined(__powerpc__) + /* __ppc__ is defined by gcc, I remember having seen __powerpc__ once, + * but can't find it ATM */ + #define NPY_TARGET_CPU NPY_PPC +#elif defined(__sparc__) || defined(__sparc) + /* __sparc__ is defined by gcc and Forte (e.g. Sun) compilers */ + #define NPY_TARGET_CPU NPY_SPARC +#elif defined(__s390__) + #define NPY_TARGET_CPU NPY_S390 +#elif defined(__parisc__) + /* XXX: Not sure about this one... */ + #define NPY_TARGET_CPU NPY_PA_RISC +#else + #error Unknown CPU, please report this to numpy maintainers with \ + information about your platform +#endif + +#endif -- cgit v1.2.1