MCPcopy Create free account
hub / github.com/numpy/numpy / get_array_memory_extents

Function get_array_memory_extents

numpy/core/src/common/mem_overlap.c:693–710  ·  view source on GitHub ↗

Gets a half-open range [start, end) which contains the array data */

Source from the content-addressed store, hash-verified

691
692/* Gets a half-open range [start, end) which contains the array data */
693static void
694get_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
713static int

Callers 1

solve_may_share_memoryFunction · 0.85

Calls 7

PyArray_ITEMSIZEFunction · 0.85
PyArray_NDIMFunction · 0.85
PyArray_DIMSFunction · 0.85
PyArray_STRIDESFunction · 0.85
PyArray_DATAFunction · 0.85
PyArray_DIMFunction · 0.85

Tested by

no test coverage detected