aboutsummaryrefslogtreecommitdiff
path: root/core/runtime
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-09-30 12:38:40 +0100
committergingerBill <bill@gingerbill.org>2020-09-30 12:38:40 +0100
commitc35d533ce5edbf5e8a4877df804699f3218f4850 (patch)
tree5668308507a736ebb3cab30316facfed77c7fb44 /core/runtime
parent464e733b888432d07e8516729d4e724431e7edcc (diff)
Replace the `*_remove_range` with procedures with `remove_range`
Diffstat (limited to 'core/runtime')
-rw-r--r--core/runtime/core.odin14
1 files changed, 4 insertions, 10 deletions
diff --git a/core/runtime/core.odin b/core/runtime/core.odin
index df5ef7a46..527c85c2b 100644
--- a/core/runtime/core.odin
+++ b/core/runtime/core.odin
@@ -587,19 +587,13 @@ ordered_remove :: proc(array: ^$D/[dynamic]$T, index: int, loc := #caller_locati
}
@builtin
-unordered_remove_range :: proc(array: ^$D/[dynamic]$T, lo, hi: int, loc := #caller_location) {
- slice_expr_error_lo_hi_loc(loc, lo, hi, len(array));
- for index in lo..<hi {
- unordered_remove(array, index, loc);
- }
-}
-
-@builtin
-ordered_remove_range :: proc(array: ^$D/[dynamic]$T, lo, hi: int, loc := #caller_location) {
+remove_range :: proc(array: ^$D/[dynamic]$T, lo, hi: int, loc := #caller_location) {
slice_expr_error_lo_hi_loc(loc, lo, hi, len(array));
n := max(hi-lo, 0);
if n > 0 {
- copy(array[lo:], array[hi:]);
+ if hi != len(array) {
+ copy(array[lo:], array[hi:]);
+ }
(^Raw_Dynamic_Array)(array).len -= n;
}
}