For an array x of dimension n, and given index i, returns j, 0 <= j < n * such as x[i] = x[j], with x assumed to be mirrored. For example, for x = * {1, 2, 3} (n = 3) * * index -5 -4 -3 -2 -1 0 1 2 3 4 5 6 * value 2 3 3 2 1 1 2 3 3 2 1 1 * * _npy_pos_index_mirror(4, 3) will return 1, because x[4] = x[1]*/
| 1616 | * |
| 1617 | * _npy_pos_index_mirror(4, 3) will return 1, because x[4] = x[1]*/ |
| 1618 | static inline npy_intp |
| 1619 | __npy_pos_remainder(npy_intp i, npy_intp n) |
| 1620 | { |
| 1621 | npy_intp k, l, j; |
| 1622 | |
| 1623 | /* Mirror i such as it is guaranteed to be positive */ |
| 1624 | if (i < 0) { |
| 1625 | i = - i - 1; |
| 1626 | } |
| 1627 | |
| 1628 | /* compute k and l such as i = k * n + l, 0 <= l < k */ |
| 1629 | k = i / n; |
| 1630 | l = i - k * n; |
| 1631 | |
| 1632 | if (_NPY_IS_EVEN(k)) { |
| 1633 | j = l; |
| 1634 | } else { |
| 1635 | j = n - 1 - l; |
| 1636 | } |
| 1637 | return j; |
| 1638 | } |
| 1639 | #undef _NPY_IS_EVEN |
| 1640 | |
| 1641 | #define _INF_SET_PTR_MIRROR(c) \ |
nothing calls this directly
no outgoing calls
no test coverage detected