MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / trimIndex

Method trimIndex

src/backend/oneapi/kernel/index.hpp:44–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42 , nBBS1(nBBS1_) {}
43
44 int trimIndex(int idx, const int len) const {
45 int ret_val = idx;
46 if (ret_val < 0) {
47 int offset = (abs(ret_val) - 1) % len;
48 ret_val = offset;
49 } else if (ret_val >= len) {
50 int offset = abs(ret_val) % len;
51 ret_val = len - offset - 1;
52 }
53 return ret_val;
54 }
55
56 void operator()(sycl::nd_item<3> it) const {
57 // retrieve index pointers

Callers

nothing calls this directly

Calls 1

absFunction · 0.50

Tested by

no test coverage detected