diff options
author | Bobby Bingham <koorogi@koorogi.info> | 2014-06-30 00:37:37 -0500 |
---|---|---|
committer | Bobby Bingham <koorogi@koorogi.info> | 2014-06-30 00:37:37 -0500 |
commit | 7c9343faae62800f6a4c39f7e127bcbde36cd584 (patch) | |
tree | 352da3ecd226c2ff25a858aeedda00187b86e30e /wikisort.c | |
parent | e0dfea0a485fbf3bdeaed3634dd65797a3c67397 (diff) |
Small cleanup
Diffstat (limited to 'wikisort.c')
-rw-r--r-- | wikisort.c | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -192,7 +192,6 @@ void wikisort(void *unsorted, size_t nmel, size_t width, cmpfun cmp) char *mina = a.base, *penda; while (a.nmel) { size_t rolled_blocks = b.nmel ? roll(&a, &b, bwidth, width, &mina, cmp) : 0; - size_t offset; /* move mina block to immediately after rolled b blocks */ if (mina != a.base) swap(mina, a.base, bwidth); @@ -200,24 +199,22 @@ void wikisort(void *unsorted, size_t nmel, size_t width, cmpfun cmp) /* rotate mina into correct spot in the last rolled b */ nmel_pend_b += rolled_blocks * bnmel; if (nmel_pend_b) { - offset = nmel_pend_b - binary_search(a.base, a.base - nmel_pend_b * width, nmel_pend_b, width, cmp); + size_t offset = nmel_pend_b - binary_search(a.base, a.base - nmel_pend_b * width, nmel_pend_b, width, cmp); rotate(a.base - offset * width, bnmel + offset, width, offset); - /* merge any previous pending as and bs */ nmel_pend_b -= offset; if (nmel_pend_a && nmel_pend_b) { merge_blocks(buf.base, penda, nmel_pend_a, nmel_pend_b, width, cmp); } + penda = a.base - offset * width; nmel_pend_a = bnmel; nmel_pend_b = offset; } else { nmel_pend_a = 0; nmel_pend_b = 0; - offset = 0; } - penda = a.base - offset * width; a.base += bwidth; if (--a.nmel) { mina = find_min_block(a.base, a.nmel, bwidth, width, cmp); |