From: Brendan Hansen Date: Wed, 16 Dec 2020 19:32:08 +0000 (-0600) Subject: bug fix in array.remove X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=cfa1a5f6c32ee8009eb2a0b846be29f1a3f55741;p=onyx.git bug fix in array.remove --- diff --git a/core/array.onyx b/core/array.onyx index 18c6f0f8..16508474 100644 --- a/core/array.onyx +++ b/core/array.onyx @@ -54,7 +54,9 @@ insert :: proc (arr: ^[..] $T, idx: u32, x: T) -> bool { remove :: proc (arr: ^[..] $T, elem: T) { move := 0; - for i: 0 .. arr.count - move { + while i := 0; i < arr.count - move { + defer i += 1; + if arr.data[i + move] == elem do move += 1; if move != 0 do arr.data[i] = arr.data[i + move]; }