Merge pull request #6771 from TheRadischen/patch-2

rotate crashes with 0 length
This commit is contained in:
gingerBill
2026-06-04 15:48:40 +01:00
committed by GitHub

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