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

Function trimIndex

src/backend/cuda/utility.hpp:18–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16namespace cuda {
17
18[[gnu::unused]] static __DH__ dim_t trimIndex(const int &idx,
19 const dim_t &len) {
20 int ret_val = idx;
21 if (ret_val < 0) {
22 int offset = (abs(ret_val) - 1) % len;
23 ret_val = offset;
24 } else if (ret_val >= len) {
25 int offset = abs(ret_val) % len;
26 ret_val = len - offset - 1;
27 }
28 return ret_val;
29}
30
31int interpOrder(const af_interp_type p) noexcept;
32

Callers

nothing calls this directly

Calls 1

absFunction · 0.70

Tested by

no test coverage detected