Commit 5bf7fea5 authored by Dag Sverre Seljebotn's avatar Dag Sverre Seljebotn

numpy.pxd: Add intp_t and uintp_t

parent ebcf2c43
......@@ -26,6 +26,7 @@ cdef extern from "Python.h":
cdef extern from "numpy/arrayobject.h":
ctypedef Py_intptr_t npy_intp
ctypedef size_t npy_uintp
cdef enum NPY_TYPES:
NPY_BOOL
......@@ -193,7 +194,7 @@ cdef extern from "numpy/arrayobject.h":
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:
......@@ -735,7 +736,8 @@ ctypedef double complex complex128_t
# 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
......
......@@ -140,6 +140,8 @@ try:
>>> 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)
......@@ -315,6 +317,8 @@ def inc1_long_t(np.ndarray[np.long_t] arr): arr[1] += 1
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment