summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2008-11-25 13:56:49 +0000
committerDavid Cournapeau <cournape@gmail.com>2008-11-25 13:56:49 +0000
commitaf9e54158cdfe9d779da709f423bbc2e331bf1da (patch)
tree89fc23d35202ca22bae3d2789f7d71072c0381a1 /numpy
parentd1cc65d824e701e47a48a35f26655ca6706307d8 (diff)
downloadnumpy-af9e54158cdfe9d779da709f423bbc2e331bf1da.tar.gz
Add a (public) header to detect common CPU archs.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/include/numpy/cpuarch.h32
1 files changed, 32 insertions, 0 deletions
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