* @brief Counts the number of elements in a range that satisfy a predicate function. * * This function iterates over the elements in the range `[base, base + num * size)` and counts * how many of them satisfy the predicate function `pred`. * * @param base Pointer to the start of the array. * @param num Number of elements in the array. * @param size Size of each element in bytes. * @param p
| 819 | else { |
| 820 | stb_merge(l, r, r, re, out, sz, comp); |
| 821 | } |
| 822 | i = end; |
| 823 | } |
| 824 | if (pend) { |
| 825 | stb_parity_merge(pend, pend_n, pend_out, sz, comp); |
| 826 | } |
| 827 | } |
| 828 | |
| 829 | /* Sorts a[0, n) stably: insertion-sorted runs, then merge passes between |
| 830 | * `a` and `buf` (n elements). Already sorted input and strictly descending |
| 831 | * input (reversed; reversing it is stable) are recognised in one pass. */ |
| 832 | ALG_INLINE void stb_sort_impl(char *a, size_t n, size_t sz, AlgorithmCompareFunc comp, char *tmp, char *buf) { |
| 833 | size_t asc = 1; |
| 834 | while (asc < n && !(comp(a + asc * sz, a + (asc - 1) * sz) < 0)) { |
| 835 | ++asc; |
| 836 | } |
| 837 | if (asc == n) { |
| 838 | return; /* already sorted */ |
nothing calls this directly
no outgoing calls
no test coverage detected