mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 05:08:14 +00:00
Replace the *_remove_range with procedures with remove_range
This commit is contained in:
+4
-10
@@ -587,19 +587,13 @@ ordered_remove :: proc(array: ^$D/[dynamic]$T, index: int, loc := #caller_locati
|
|||||||
}
|
}
|
||||||
|
|
||||||
@builtin
|
@builtin
|
||||||
unordered_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));
|
|
||||||
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) {
|
|
||||||
slice_expr_error_lo_hi_loc(loc, lo, hi, len(array));
|
slice_expr_error_lo_hi_loc(loc, lo, hi, len(array));
|
||||||
n := max(hi-lo, 0);
|
n := max(hi-lo, 0);
|
||||||
if n > 0 {
|
if n > 0 {
|
||||||
copy(array[lo:], array[hi:]);
|
if hi != len(array) {
|
||||||
|
copy(array[lo:], array[hi:]);
|
||||||
|
}
|
||||||
(^Raw_Dynamic_Array)(array).len -= n;
|
(^Raw_Dynamic_Array)(array).len -= n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user