MCPcopy Create free account
hub / github.com/numpy/numpy / npy_merge_left

Function npy_merge_left

numpy/core/src/npysort/timsort.cpp:2054–2081  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2052}
2053
2054static void
2055npy_merge_left(char *p1, npy_intp l1, char *p2, npy_intp l2, char *p3,
2056 size_t len, PyArray_CompareFunc *cmp, PyArrayObject *py_arr)
2057{
2058 char *end = p2 + l2 * len;
2059 memcpy(p3, p1, sizeof(char) * l1 * len);
2060 /* first element must be in p2 otherwise skipped in the caller */
2061 GENERIC_COPY(p1, p2, len);
2062 p1 += len;
2063 p2 += len;
2064
2065 while (p1 < p2 && p2 < end) {
2066 if (cmp(p2, p3, py_arr) < 0) {
2067 GENERIC_COPY(p1, p2, len);
2068 p1 += len;
2069 p2 += len;
2070 }
2071 else {
2072 GENERIC_COPY(p1, p3, len);
2073 p1 += len;
2074 p3 += len;
2075 }
2076 }
2077
2078 if (p1 != p2) {
2079 memcpy(p1, p3, sizeof(char) * (p2 - p1));
2080 }
2081}
2082
2083static void
2084npy_merge_right(char *p1, npy_intp l1, char *p2, npy_intp l2, char *p3,

Callers 1

npy_merge_atFunction · 0.85

Calls 1

GENERIC_COPYFunction · 0.85

Tested by

no test coverage detected