* @brief Reduces a range of elements to a single value using a specified binary operation. * * This function applies the binary operation `op` to each element in the range `[base, base + num * size)` * and accumulates the result, starting with the initial value `init`. * * @param base Pointer to the start of the array. * @param num Number of elements in the array. * @param size Size of each
| 989 | int take_r = comp(r, l) < 0; |
| 990 | const char *s = take_r ? r : l; |
| 991 | alg_copy_elem(out, s, sz); |
| 992 | out += sz; |
| 993 | r += take_r ? sz : 0; |
| 994 | l += take_r ? 0 : sz; |
| 995 | } |
| 996 | if (l != le) { |
| 997 | memcpy(out, l, (size_t)(le - l)); |
| 998 | } |
| 999 | } |
| 1000 | else { |
| 1001 | /* right run aside, merge backward from the end */ |
| 1002 | memcpy(buf, a + n1 * sz, n2 * sz); |
| 1003 | const char *l = a + n1 * sz, *lb = a; /* left: [lb, l) */ |
| 1004 | const char *r = buf + n2 * sz, *rb = buf; /* right: [rb, r) */ |
| 1005 | char *out = a + n * sz; |
| 1006 | while (l != lb && r != rb) { |
| 1007 | int take_l = comp(r - sz, l - sz) < 0; /* right < left: left goes last */ |
nothing calls this directly
no outgoing calls
no test coverage detected