MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / cvt_idx

Function cvt_idx

flow-message/src/cross/python/mod.rs:51–57  ·  view source on GitHub ↗
(len: usize, idx: isize)

Source from the content-addressed store, hash-verified

49
50#[inline]
51fn cvt_idx(len: usize, idx: isize) -> usize {
52 if idx < 0 {
53 len - idx.abs() as usize
54 } else {
55 idx as usize
56 }
57}
58
59fn to_data(py: Python, object: PyObject) -> PyResult<data::Data> {
60 let value = object.as_ref(py);

Callers 5

__setitem__Method · 0.85
__getitem__Method · 0.85
__delitem__Method · 0.85
__setitem__Method · 0.85
__getitem__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected