diff options
-rw-r--r-- | wikisort.c | 8 |
1 files changed, 2 insertions, 6 deletions
@@ -96,18 +96,14 @@ static size_t roll(struct blockarray *a, struct blockarray *b, size_t bwidth, size_t width, char **mina, cmpfun cmp) { size_t iters = 0; - char *prevb; - - do { + while (b->blocks && cmp(b->base , *mina + bwidth - width) < 0) { swap(a->base, b->base, bwidth); if (*mina == a->base) *mina = b->base; - prevb = a->base; a->base += bwidth; b->base += bwidth; b->blocks--; iters++; - } while (b->blocks && cmp(prevb + bwidth - width, *mina) < 0); - + } return iters; } |