| 16 | namespace arrayfire { |
| 17 | namespace cpu { |
| 18 | static inline dim_t trimIndex(int const& idx, dim_t const& len) { |
| 19 | int ret_val = idx; |
| 20 | if (ret_val < 0) { |
| 21 | int offset = (abs(ret_val) - 1) % len; |
| 22 | ret_val = offset; |
| 23 | } else if (ret_val >= (int)len) { |
| 24 | int offset = abs(ret_val) % len; |
| 25 | ret_val = len - offset - 1; |
| 26 | } |
| 27 | return ret_val; |
| 28 | } |
| 29 | |
| 30 | static inline unsigned getIdx(af::dim4 const& strides, int i, int j = 0, |
| 31 | int k = 0, int l = 0) { |
no test coverage detected