MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/Imath / getitem_slice

Method getitem_slice

src/python/PyImath/PyImathFixedVArray.cpp:587–614  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

585
586template <class T>
587FixedArray<int>
588FixedVArray<T>::SizeHelper::getitem_slice (PyObject* index) const
589{
590 size_t start = 0;
591 size_t end = 0;
592 size_t sliceLength = 0;
593 Py_ssize_t step;
594 extract_slice_indices (index, start, end, step, sliceLength, _a._length);
595
596 FixedArray<int> f(sliceLength);
597
598 if (_a._indices)
599 {
600 for (size_t i = 0; i < sliceLength; ++i)
601 {
602 f.direct_index(i) = _a._ptr[_a.raw_ptr_index(start + i*step)*_a._stride].size();
603 }
604 }
605 else
606 {
607 for (size_t i = 0; i < sliceLength; ++i)
608 {
609 f.direct_index(i) = _a._ptr[(start + i*step)*_a._stride].size();
610 }
611 }
612
613 return f;
614}
615
616template <class T>
617FixedArray<int>

Callers

nothing calls this directly

Calls 3

extract_slice_indicesFunction · 0.85
sizeMethod · 0.45
raw_ptr_indexMethod · 0.45

Tested by

no test coverage detected