Lines Matching refs:size
44 * Swap two areas of size number of bytes. Although qsort(3) permits random
50 #define SWAP(a, b, count, size, tmp) { \
51 count = size; \
59 /* Copy one block of size size to another. */
60 #define COPY(a, b, count, size, tmp1, tmp2) { \
61 count = size; \
76 #define CREATE(initval, nmemb, par_i, child_i, par, child, size, count, tmp) { \
79 child = base + child_i * size; \
80 if (child_i < nmemb && compar(child, child + size) < 0) { \
81 child += size; \
84 par = base + par_i * size; \
87 SWAP(par, child, count, size, tmp); \
108 #define SELECT(par_i, child_i, nmemb, par, child, size, k, count, tmp1, tmp2) { \
110 child = base + child_i * size; \
111 if (child_i < nmemb && compar(child, child + size) < 0) { \
112 child += size; \
115 par = base + par_i * size; \
116 COPY(par, child, count, size, tmp1, tmp2); \
121 child = base + child_i * size; \
122 par = base + par_i * size; \
124 COPY(child, k, count, size, tmp1, tmp2); \
127 COPY(child, par, count, size, tmp1, tmp2); \
139 heapsort(vbase, nmemb, size, compar)
141 size_t nmemb, size;
151 if (!size) {
156 if ((k = malloc(size)) == NULL)
160 * Items are numbered from 1 to nmemb, so offset from size bytes
163 base = (char *)vbase - size;
166 CREATE(l, nmemb, i, j, t, p, size, cnt, tmp);
174 COPY(k, base + nmemb * size, cnt, size, tmp1, tmp2);
175 COPY(base + nmemb * size, base + size, cnt, size, tmp1, tmp2);
177 SELECT(i, j, nmemb, t, p, size, k, cnt, tmp1, tmp2);