Gets a half-open range [start, end) which contains the array data */
| 691 | |
| 692 | /* Gets a half-open range [start, end) which contains the array data */ |
| 693 | static void |
| 694 | get_array_memory_extents(PyArrayObject *arr, |
| 695 | npy_uintp *out_start, npy_uintp *out_end, |
| 696 | npy_uintp *num_bytes) |
| 697 | { |
| 698 | npy_intp low, upper; |
| 699 | int j; |
| 700 | offset_bounds_from_strides(PyArray_ITEMSIZE(arr), PyArray_NDIM(arr), |
| 701 | PyArray_DIMS(arr), PyArray_STRIDES(arr), |
| 702 | &low, &upper); |
| 703 | *out_start = (npy_uintp)PyArray_DATA(arr) + (npy_uintp)low; |
| 704 | *out_end = (npy_uintp)PyArray_DATA(arr) + (npy_uintp)upper; |
| 705 | |
| 706 | *num_bytes = PyArray_ITEMSIZE(arr); |
| 707 | for (j = 0; j < PyArray_NDIM(arr); ++j) { |
| 708 | *num_bytes *= PyArray_DIM(arr, j); |
| 709 | } |
| 710 | } |
| 711 | |
| 712 | |
| 713 | static int |
no test coverage detected