commit 6f256b72d8dc014aa49cbf42e65c3d627e8dc32a
parent fc3fb4be417fe55920469ebef2ad0a2f41e8b732
Author: Bor Grošelj Simić <bgs@turminal.net>
Date: Sun, 22 Dec 2024 14:58:39 +0100
sort: don't use left sublicing operand on opaque slice
This is invalid and harec was wrong for letting it happen. Fortunately
the offset used was 0 so there were no actual consequences for the
compiled code.
Signed-off-by: Bor Grošelj Simić <bgs@turminal.net>
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sort/sort.ha b/sort/sort.ha
@@ -62,7 +62,7 @@ fn search_rightmost(
fn insort(items: []opaque, itemsz: size, cmp: *cmpfunc) void = {
let ba = items: *[*]u8;
for (let i = 0z; i < len(items); i += 1) {
- let bound = search_rightmost(items[0..i], itemsz,
+ let bound = search_rightmost(items[..i], itemsz,
&ba[i * itemsz], cmp);
for (let j = i; j > bound + 1; j -= 1) {
let a = &ba[(j - 1) * itemsz];