NdArrayGetFn

Type Alias NdArrayGetFn 

Source
pub type NdArrayGetFn = unsafe fn(array: PtrConst, index: usize) -> Option<PtrConst>;
Expand description

Get pointer to the element at index in the array, or None if the index is out of bounds.

The flat index is transformed into separate array indices like this:

 - i0 = index % d0;
 - i1 = index / d0 % d1;
 - …
 - i{n-1} = index / d0 / d1 / ... / d{n-1} % dn;
 - remainder = index / d0 / d1 / ... / dn;

if remainder is non-zero, the index is out of bounds and None is returned.

§Safety

The array parameter must point to aligned, initialized memory of the correct type.