diff options
| author | gingerBill <bill@gingerbill.org> | 2019-03-25 21:29:21 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2019-03-25 21:29:21 +0000 |
| commit | 1fd677b42e33cf0407e204830df656fc1a931df5 (patch) | |
| tree | 1616b18b106b844975cfa589c7020f4f61a0908f /core/runtime | |
| parent | 6b18b90222a1a9448f30709cd445a4af282b146f (diff) | |
Remove *_remove from demo and use built-in versions
Diffstat (limited to 'core/runtime')
| -rw-r--r-- | core/runtime/core.odin | 4 | ||||
| -rw-r--r-- | core/runtime/internal.odin | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/core/runtime/core.odin b/core/runtime/core.odin index 1ce7cfac5..187573557 100644 --- a/core/runtime/core.odin +++ b/core/runtime/core.odin @@ -403,7 +403,9 @@ unordered_remove :: proc(array: ^$D/[dynamic]$T, index: int, loc := #caller_loca @builtin ordered_remove :: proc(array: ^$D/[dynamic]$T, index: int, loc := #caller_location) { bounds_check_error_loc(loc, index, len(array)); - copy(array[index:], array[index+1:]); + if index+1 < len(array) { + copy(array[index:], array[index+1:]); + } pop(array); } diff --git a/core/runtime/internal.odin b/core/runtime/internal.odin index 202f739b6..82cd4cb72 100644 --- a/core/runtime/internal.odin +++ b/core/runtime/internal.odin @@ -303,7 +303,7 @@ slice_expr_error_hi :: proc "contextless" (file: string, line, column: int, hi: } slice_expr_error_lo_hi :: proc "contextless" (file: string, line, column: int, lo, hi: int, len: int) { - if 0 <= lo && lo < len && len <= hi && hi <= len do return; + if 0 <= lo && lo < len && lo <= hi && hi <= len do return; handle_error :: proc "contextless" (file: string, line, column: int, lo, hi: int, len: int) { fd := os.stderr; print_caller_location(fd, Source_Code_Location{file, line, column, "", 0}); |