Lines Matching refs:cmp
309 int (*cmp)(const void *, const void *, void *),
313 rqsort_cmp = cmp;
459 static void heapsortx(void *base, size_t nmemb, size_t size, cmp_f cmp, void *opaque) in heapsortx() argument
472 if (c < n - size && cmp(basep + c, basep + c + size, opaque) <= 0) in heapsortx()
474 if (cmp(basep + r, basep + c, opaque) > 0) in heapsortx()
483 if (c < i - size && cmp(basep + c, basep + c + size, opaque) <= 0) in heapsortx()
485 if (cmp(basep + r, basep + c, opaque) > 0) in heapsortx()
493 static inline void *med3(void *a, void *b, void *c, cmp_f cmp, void *opaque) in med3() argument
495 return cmp(a, b, opaque) < 0 ? in med3()
496 (cmp(b, c, opaque) < 0 ? b : (cmp(a, c, opaque) < 0 ? c : a )) : in med3()
497 (cmp(b, c, opaque) > 0 ? b : (cmp(a, c, opaque) < 0 ? a : c )); in med3()
501 void rqsort(void *base, size_t nmemb, size_t size, cmp_f cmp, void *opaque) in rqsort() argument
527 heapsortx(ptr, nmemb, size, cmp, opaque); in rqsort()
534 m = med3(ptr + m4, ptr + 2 * m4, ptr + 3 * m4, cmp, opaque); in rqsort()
541 while (pi < pj && (c = cmp(ptr, pi, opaque)) >= 0) { in rqsort()
550 while (pi < (pj -= size) && (c = cmp(ptr, pj, opaque)) <= 0) { in rqsort()
614 for (pj = pi; pj > ptr && cmp(pj - size, pj, opaque) > 0; pj -= size) in rqsort()