summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2008-08-03 09:35:15 +0000
committerDavid Cournapeau <cournape@gmail.com>2008-08-03 09:35:15 +0000
commit4a0807f9e770fcc139601f6646ef71af90dc90d1 (patch)
tree5db217fd0ae9024ecdcc386d55b8cb996f119e3a
parent62dbc75d31c0fddc2da71f8a1f769ea8b5fac9a1 (diff)
downloadnumpy-4a0807f9e770fcc139601f6646ef71af90dc90d1.tar.gz
Use inttypes format if available for NPY_INTP.
-rw-r--r--numpy/core/include/numpy/ndarrayobject.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/numpy/core/include/numpy/ndarrayobject.h b/numpy/core/include/numpy/ndarrayobject.h
index 837d8157f..33c165c15 100644
--- a/numpy/core/include/numpy/ndarrayobject.h
+++ b/numpy/core/include/numpy/ndarrayobject.h
@@ -971,6 +971,22 @@ typedef Py_uintptr_t npy_uintp;
#define NPY_INTP_FMT "Ld"
#endif
+/* If available, use formats in inttypes for (u)intp types. */
+#ifdef HAVE_UINTPTR_T /* set in pyconfig.h */
+ #ifdef HAVE_INTTYPES_H /* set in pyconfig.h */
+ #include <inttypes.h>
+
+ #undef NPY_MAX_INTP
+ #undef NPY_MIN_INTP
+ #undef NPY_MAX_UINTP
+ #undef NPY_INTP_FMT
+ #define NPY_MAX_INTP INTPTR_MAX
+ #define NPY_MIN_INTP INTPTR_MIN
+ #define NPY_MAX_UINTP UINTPTR_MAX
+ #define NPY_INTP_FMT PRIdPTR
+ #endif
+#endif
+
#define NPY_ERR(str) fprintf(stderr, #str); fflush(stderr);
#define NPY_ERR2(str) fprintf(stderr, str); fflush(stderr);