block broken case for now

This commit is contained in:
Brendan Hansknecht 2024-07-24 20:26:26 -07:00
parent 2bbb17c1de
commit 1e7a03ef12
No known key found for this signature in database
GPG key ID: 0EA784685083E75B

View file

@ -76,11 +76,11 @@ fn quadsort_direct(
} else if (quad_swap(arr_ptr, len, cmp, cmp_data, element_width, copy) != .sorted) { } else if (quad_swap(arr_ptr, len, cmp, cmp_data, element_width, copy) != .sorted) {
var swap_size = len; var swap_size = len;
// for crazy large arrays, limit swap. // This is optional, for about 5% perf hit, lower memory usage on large arrays.
if (len > 4194304) { // if (len > 4194304) {
swap_size = 4194304; // swap_size = 4194304;
while (swap_size * 8 <= len) : (swap_size *= 4) {} // while (swap_size * 8 <= len) : (swap_size *= 4) {}
} // }
if (utils.alloc(swap_size * element_width, alignment)) |swap| { if (utils.alloc(swap_size * element_width, alignment)) |swap| {
const block_len = quad_merge(arr_ptr, len, swap, swap_size, 32, cmp, cmp_data, element_width, copy); const block_len = quad_merge(arr_ptr, len, swap, swap_size, 32, cmp, cmp_data, element_width, copy);
@ -1006,14 +1006,15 @@ fn quad_swap(
arr_ptr += 8 * element_width; arr_ptr += 8 * element_width;
continue :outer; continue :outer;
}, },
15 => { // TODO: Figure out why the reversed case below is broken in some cases.
// potentially already reverse ordered, check rest! // 15 => {
if (compare(cmp, cmp_data, arr_ptr + 1 * element_width, arr_ptr + 2 * element_width) == GT and compare(cmp, cmp_data, arr_ptr + 3 * element_width, arr_ptr + 4 * element_width) == GT and compare(cmp, cmp_data, arr_ptr + 5 * element_width, arr_ptr + 6 * element_width) == GT) { // // potentially already reverse ordered, check rest!
reverse_head = arr_ptr; // if (compare(cmp, cmp_data, arr_ptr + 1 * element_width, arr_ptr + 2 * element_width) == GT and compare(cmp, cmp_data, arr_ptr + 3 * element_width, arr_ptr + 4 * element_width) == GT and compare(cmp, cmp_data, arr_ptr + 5 * element_width, arr_ptr + 6 * element_width) == GT) {
break :switch_state .reversed; // reverse_head = arr_ptr;
} // break :switch_state .reversed;
break :switch_state .not_ordered; // }
}, // break :switch_state .not_ordered;
// },
else => { else => {
break :switch_state .not_ordered; break :switch_state .not_ordered;
}, },