util.pxd 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. cimport numpy as cnp
  2. from numpy cimport ndarray
  3. from pandas._libs.tslibs.util cimport *
  4. cdef extern from "numpy/ndarraytypes.h":
  5. void PyArray_CLEARFLAGS(ndarray arr, int flags) nogil
  6. cdef extern from "numpy/arrayobject.h":
  7. enum:
  8. NPY_ARRAY_C_CONTIGUOUS
  9. NPY_ARRAY_F_CONTIGUOUS
  10. cdef extern from "src/headers/stdint.h":
  11. enum: UINT8_MAX
  12. enum: UINT16_MAX
  13. enum: UINT32_MAX
  14. enum: UINT64_MAX
  15. enum: INT8_MIN
  16. enum: INT8_MAX
  17. enum: INT16_MIN
  18. enum: INT16_MAX
  19. enum: INT32_MAX
  20. enum: INT32_MIN
  21. enum: INT64_MAX
  22. enum: INT64_MIN
  23. ctypedef fused numeric:
  24. cnp.int8_t
  25. cnp.int16_t
  26. cnp.int32_t
  27. cnp.int64_t
  28. cnp.uint8_t
  29. cnp.uint16_t
  30. cnp.uint32_t
  31. cnp.uint64_t
  32. cnp.float32_t
  33. cnp.float64_t
  34. cdef inline void set_array_not_contiguous(ndarray ao) nogil:
  35. # Numpy>=1.8-compliant equivalent to:
  36. # ao->flags &= ~(NPY_ARRAY_C_CONTIGUOUS | NPY_ARRAY_F_CONTIGUOUS);
  37. PyArray_CLEARFLAGS(ao,
  38. (NPY_ARRAY_C_CONTIGUOUS | NPY_ARRAY_F_CONTIGUOUS))