mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-13 13:53:43 +00:00
Update slice.odin
added a check for rotate_left rotating with 0 length array crashes
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user