projects
/
onyx.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ad71360
)
bug fix in array.remove
author
Brendan Hansen
<brendan.f.hansen@gmail.com>
Wed, 16 Dec 2020 19:32:08 +0000
(13:32 -0600)
committer
Brendan Hansen
<brendan.f.hansen@gmail.com>
Wed, 16 Dec 2020 19:32:08 +0000
(13:32 -0600)
core/array.onyx
patch
|
blob
|
history
diff --git
a/core/array.onyx
b/core/array.onyx
index 18c6f0f84ef4fda4fc9424f9169e9023e2c865ba..16508474e98b5acc2241996f51dcc7deeddf2f0e 100644
(file)
--- 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];
}