summaryrefslogtreecommitdiff
path: root/grailsort.c
diff options
context:
space:
mode:
Diffstat (limited to 'grailsort.c')
-rw-r--r--grailsort.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/grailsort.c b/grailsort.c
index 8d69b97..379e23a 100644
--- a/grailsort.c
+++ b/grailsort.c
@@ -25,16 +25,9 @@ size_t merge(char *buf, char *base, size_t anmel, size_t bnmel, size_t width, cm
swap(base, a, anmel * width);
- while (anmel > 0 && bnmel > 0) {
- if (cmp(a, b) <= 0) {
- swap(base, a, width);
- a += width;
- anmel--;
- } else {
- swap(base, b, width);
- b += width;
- bnmel--;
- }
+ while (anmel && bnmel) {
+ if (cmp(a, b) <= 0) { swap(base, a, width); a += width; anmel--; }
+ else { swap(base, b, width); b += width; bnmel--; }
base += width;
}