| 2081 | } |
| 2082 | |
| 2083 | static void |
| 2084 | npy_merge_right(char *p1, npy_intp l1, char *p2, npy_intp l2, char *p3, |
| 2085 | size_t len, PyArray_CompareFunc *cmp, PyArrayObject *py_arr) |
| 2086 | { |
| 2087 | npy_intp ofs; |
| 2088 | char *start = p1 - len; |
| 2089 | memcpy(p3, p2, sizeof(char) * l2 * len); |
| 2090 | p1 += (l1 - 1) * len; |
| 2091 | p2 += (l2 - 1) * len; |
| 2092 | p3 += (l2 - 1) * len; |
| 2093 | /* first element must be in p1 otherwise skipped in the caller */ |
| 2094 | GENERIC_COPY(p2, p1, len); |
| 2095 | p2 -= len; |
| 2096 | p1 -= len; |
| 2097 | |
| 2098 | while (p1 < p2 && start < p1) { |
| 2099 | if (cmp(p3, p1, py_arr) < 0) { |
| 2100 | GENERIC_COPY(p2, p1, len); |
| 2101 | p2 -= len; |
| 2102 | p1 -= len; |
| 2103 | } |
| 2104 | else { |
| 2105 | GENERIC_COPY(p2, p3, len); |
| 2106 | p2 -= len; |
| 2107 | p3 -= len; |
| 2108 | } |
| 2109 | } |
| 2110 | |
| 2111 | if (p1 != p2) { |
| 2112 | ofs = p2 - start; |
| 2113 | memcpy(start + len, p3 - ofs + len, sizeof(char) * ofs); |
| 2114 | } |
| 2115 | } |
| 2116 | |
| 2117 | static int |
| 2118 | npy_merge_at(char *arr, const run *stack, const npy_intp at, |
no test coverage detected