cdef extern from "numpy/arrayobject.h":
ctypedef Py_intptr_t npy_intp
+ ctypedef size_t npy_uintp
cdef enum NPY_TYPES:
NPY_BOOL
cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
ndim = PyArray_NDIM(self)
-
+
if sizeof(npy_intp) != sizeof(Py_ssize_t):
copy_shape = 1
else:
# numpy.int corresponds to 'l' and numpy.long to 'q'
ctypedef npy_long int_t
ctypedef npy_longlong long_t
-
+ctypedef npy_intp intp_t
+ctypedef npy_uintp uintp_t
ctypedef npy_ulong uint_t
ctypedef npy_ulonglong ulong_t
>>> test_dtype(np.long, inc1_long_t)
>>> test_dtype(np.float, inc1_float_t)
>>> test_dtype(np.double, inc1_double_t)
+ >>> test_dtype(np.intp, inc1_intp_t)
+ >>> test_dtype(np.uintp, inc1_uintp_t)
>>> test_dtype(np.longdouble, inc1_longdouble_t)
def inc1_float_t(np.ndarray[np.float_t] arr): arr[1] += 1
def inc1_double_t(np.ndarray[np.double_t] arr): arr[1] += 1
def inc1_longdouble_t(np.ndarray[np.longdouble_t] arr): arr[1] += 1
+def inc1_intp_t(np.ndarray[np.intp_t] arr): arr[1] += 1
+def inc1_uintp_t(np.ndarray[np.uintp_t] arr): arr[1] += 1
# The tests below only work on platforms that has the given types
def inc1_int32_t(np.ndarray[np.int32_t] arr): arr[1] += 1