From da240b7d6c335a46e0bbe1de9a5cc5bccaef9d47 Mon Sep 17 00:00:00 2001 From: Bobby Bingham Date: Thu, 31 Jul 2014 20:43:40 -0500 Subject: Use linear search when distributing buffer --- common.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/common.h b/common.h index 8969f1d..d7e1e47 100644 --- a/common.h +++ b/common.h @@ -37,10 +37,8 @@ static void distribute_buffer(char *base, size_t bufnmel, size_t sortnmel, size_ while (bufnmel) { char *sorted = base + bufnmel * width; - size_t insertpos = binary_search(base, sorted, sortnmel, width, cmp); - while (insertpos < sortnmel && !cmp(base, sorted + insertpos * width)) { - insertpos++; - } + size_t insertpos = 0; + for (; insertpos < sortnmel && cmp(base, sorted + insertpos * width) > 0; insertpos++); if (insertpos > 0) { rotate(base, bufnmel + insertpos, width, bufnmel); -- cgit v1.2.3