From cfa1a5f6c32ee8009eb2a0b846be29f1a3f55741 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Wed, 16 Dec 2020 13:32:08 -0600 Subject: [PATCH] bug fix in array.remove --- core/array.onyx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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]; } -- 2.25.1