MCPcopy Create free account
hub / github.com/PyO3/rust-numpy / gcd_strides

Function gcd_strides

src/borrow/shared.rs:432–442  ·  view source on GitHub ↗
(array: *mut PyArrayObject)

Source from the content-addressed store, hash-verified

430}
431
432fn gcd_strides(array: *mut PyArrayObject) -> isize {
433 let nd = unsafe { (*array).nd } as usize;
434
435 if nd == 0 {
436 return 1;
437 }
438
439 let strides = unsafe { from_raw_parts((*array).strides, nd) };
440
441 strides.iter().copied().reduce(gcd).unwrap_or(1)
442}
443
444#[cfg(test)]
445mod tests {

Callers 1

borrow_keyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected