|
@ -35,7 +35,7 @@ |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
#if defined(LIBC_SCCS) && !defined(lint) |
|
|
#if defined(LIBC_SCCS) && !defined(lint) |
|
|
static char *rcsid = "$OpenBSD: merge.c,v 1.2 1996/08/19 08:33:38 tholo Exp $"; |
|
|
|
|
|
|
|
|
static char *rcsid = "$OpenBSD: merge.c,v 1.3 1996/09/15 09:31:50 tholo Exp $"; |
|
|
#endif /* LIBC_SCCS and not lint */ |
|
|
#endif /* LIBC_SCCS and not lint */ |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
@ -147,7 +147,7 @@ mergesort(base, nmemb, size, cmp) |
|
|
sense = 0; |
|
|
sense = 0; |
|
|
} |
|
|
} |
|
|
if (!big) { /* here i = 0 */ |
|
|
if (!big) { /* here i = 0 */ |
|
|
LINEAR: while ((b += size) < t && cmp(q, b) >sense) |
|
|
|
|
|
|
|
|
while ((b += size) < t && cmp(q, b) >sense) |
|
|
if (++i == 6) { |
|
|
if (++i == 6) { |
|
|
big = 1; |
|
|
big = 1; |
|
|
goto EXPONENTIAL; |
|
|
goto EXPONENTIAL; |
|
@ -168,7 +168,7 @@ EXPONENTIAL: for (i = size; ; i <<= 1) |
|
|
goto FASTCASE; |
|
|
goto FASTCASE; |
|
|
} else |
|
|
} else |
|
|
b = p; |
|
|
b = p; |
|
|
SLOWCASE: while (t > b+size) { |
|
|
|
|
|
|
|
|
while (t > b+size) { |
|
|
i = (((t - b) / size) >> 1) * size; |
|
|
i = (((t - b) / size) >> 1) * size; |
|
|
if ((*cmp)(q, p = b + i) <= sense) |
|
|
if ((*cmp)(q, p = b + i) <= sense) |
|
|
t = p; |
|
|
t = p; |
|
|