43 int (*qcmp) (
const void *,
const void *);
46 static void qst (
qst_t * q,
char * base,
char *max);
56 int (*compar) (
const void *,
const void *))
74 max = base + n * q->
qsz;
87 for (j = lo = base; (lo += q->
qsz) < hi;) {
88 if ((*compar) (j,
lo) > 0)
92 for (i = base, hi = base + q->
qsz; i < hi;) {
105 for (min = base; (hi = min += q->
qsz) < max;) {
106 while ((*q->
qcmp) (hi -= q->
qsz, min) > 0);
107 if ((hi += q->
qsz) != min) {
108 for (lo = min + q->
qsz; --lo >= min;) {
110 for (i = j = lo; (j -= q->
qsz) >= hi; i = j)
148 lo = (int)(max - base);
159 mid = i = base + qsz * ((unsigned) (lo / qsz) >> 1);
161 j = ((*q->
qcmp) ((jj = base),
i) > 0 ? jj : i);
162 if ((*q->
qcmp) (j, (tmp = max - qsz)) > 0) {
164 j = (j == jj ? i : jj);
165 if ((*q->
qcmp) (j, tmp) < 0)
178 for (i = base, j = max - qsz;;) {
179 while (i < mid && (*q->
qcmp) (
i, mid) <= 0)
182 if ((*q->
qcmp) (mid, j) <= 0) {
219 if ((lo = (
int)(j - base)) <= (hi = (int)(max - i))) {
229 }
while (lo >= q->
thresh);
sll srl srl sll sra u16x4 i
static void qst(qst_t *q, char *base, char *max)
int(* qcmp)(const void *, const void *)
void qsort(void *base, uword n, uword size, int(*compar)(const void *, const void *))