summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby Bingham <koorogi@koorogi.info>2014-07-31 21:50:28 -0500
committerBobby Bingham <koorogi@koorogi.info>2014-07-31 21:50:28 -0500
commita542b5d638db3b1cceeaeb08a07bab541ec7785f (patch)
tree0e994474908fd42a7e7a50c4dcee685ed8e713fa
parenta3d41b3ca19c8dfc306ac16f0b659961f1bd6255 (diff)
Remove grailsort dependency on bsearch
-rw-r--r--grailsort.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/grailsort.c b/grailsort.c
index 67528ca..8d69b97 100644
--- a/grailsort.c
+++ b/grailsort.c
@@ -19,9 +19,9 @@ size_t merge(char *buf, char *base, size_t anmel, size_t bnmel, size_t width, cm
{
char *a = buf;
char *b = base + anmel * width;
- size_t sorted = binary_search(b, base, anmel, width, cmp);
- base += sorted * width;
- anmel -= sorted;
+ size_t sorted;
+
+ for (sorted = 0; anmel && bnmel && cmp(base, b) <= 0; sorted++, anmel--) base += width;
swap(base, a, anmel * width);