summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@FreeBSD.org>2003-11-11 04:59:23 +0000
committerTim Kientzle <kientzle@FreeBSD.org>2003-11-11 04:59:23 +0000
commit669073a7e6fa4336323b23a9e3e0e76051c09c47 (patch)
tree7afdfa035e259b48009df82831561b9904724394
parentb10221ffd96f06223a45a804717ce50f4ff7ed1d (diff)
Notes
-rw-r--r--lib/libc/stdlib/radixsort.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/libc/stdlib/radixsort.c b/lib/libc/stdlib/radixsort.c
index de5cd4b67d4ed..933474470a27d 100644
--- a/lib/libc/stdlib/radixsort.c
+++ b/lib/libc/stdlib/radixsort.c
@@ -177,6 +177,17 @@ r_sort_a(a, n, i, tr, endch)
}
/*
+ * Special case: if all strings have the same
+ * character at position i, move on to the next
+ * character.
+ */
+ if (nc == 1 && count[bmin] == n) {
+ push(a, n, i+1);
+ nc = count[bmin] = 0;
+ continue;
+ }
+
+ /*
* Set top[]; push incompletely sorted bins onto stack.
* top[] = pointers to last out-of-place element in bins.
* count[] = counts of elements in bins.