turn a few while loops into for loops for clarity

This commit is contained in:
Brendan Hansknecht 2024-07-25 23:25:04 -07:00
parent f9abfcbb16
commit 7254122d30
No known key found for this signature in database
GPG Key ID: 0EA784685083E75B

View File

@ -1187,14 +1187,9 @@ fn cross_merge(
break;
// Large enough to warrent a two way merge.
var loops: usize = 8;
while (true) {
for (0..8) |_| {
head_branchless_merge(&dest_head, &left_head, &right_head, cmp, cmp_data, element_width, copy);
tail_branchless_merge(&dest_tail, &left_tail, &right_tail, cmp, cmp_data, element_width, copy);
loops -= 1;
if (loops == 0)
break;
}
}
@ -1811,8 +1806,7 @@ fn parity_merge(
}
head_branchless_merge(&dest_head, &left_head, &right_head, cmp, cmp_data, element_width, copy);
var ll = left_len - 1;
while (ll != 0) : (ll -= 1) {
for (0..(left_len - 1)) |_| {
head_branchless_merge(&dest_head, &left_head, &right_head, cmp, cmp_data, element_width, copy);
tail_branchless_merge(&dest_tail, &left_tail, &right_tail, cmp, cmp_data, element_width, copy);
}