diff options
author | Bobby Bingham <koorogi@koorogi.info> | 2014-07-31 20:43:40 -0500 |
---|---|---|
committer | Bobby Bingham <koorogi@koorogi.info> | 2014-07-31 20:43:40 -0500 |
commit | da240b7d6c335a46e0bbe1de9a5cc5bccaef9d47 (patch) | |
tree | e5516b12413a3882a6d89640f7e030f36e87f1f9 | |
parent | 9b5146db99cc1bb94d434762bc5d20f50c5cbe3b (diff) |
Use linear search when distributing buffer
-rw-r--r-- | common.h | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -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); |