Update slice.odin

added a check for rotate_left

rotating with 0 length array crashes
This commit is contained in:
TheRadischen
2026-06-03 22:33:49 +02:00
committed by GitHub
parent d9b9acdf47
commit 639196f28d

View File

@@ -433,6 +433,9 @@ fill :: proc "contextless" (array: $T/[]$E, value: E) #no_bounds_check {
}
rotate_left :: proc "contextless" (array: $T/[]$E, mid: int) {
if len(a) == 0 {
return
}
n := len(array)
m := mid %% n
k := n - m