aboutsummaryrefslogtreecommitdiff
path: root/core/runtime
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-09-27 22:31:46 +0100
committergingerBill <bill@gingerbill.org>2022-09-27 22:31:46 +0100
commitc4d19dfa925ffe44c04fcda90543a272b7165274 (patch)
treec493697ab16154885febf04511f7f61e64b4bbbb /core/runtime
parent35e70f4be17f4123ec25108d664864f13b38087e (diff)
Use `uint` instead of `int` to improve code generation for bounds checking
Diffstat (limited to 'core/runtime')
-rw-r--r--core/runtime/error_checks.odin6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/runtime/error_checks.odin b/core/runtime/error_checks.odin
index 0d0b39072..8539c724d 100644
--- a/core/runtime/error_checks.odin
+++ b/core/runtime/error_checks.odin
@@ -18,7 +18,7 @@ type_assertion_trap :: proc "contextless" () -> ! {
bounds_check_error :: proc "contextless" (file: string, line, column: i32, index, count: int) {
- if 0 <= index && index < count {
+ if uint(index) < uint(count) {
return
}
@(cold)
@@ -99,8 +99,8 @@ dynamic_array_expr_error :: proc "contextless" (file: string, line, column: i32,
matrix_bounds_check_error :: proc "contextless" (file: string, line, column: i32, row_index, column_index, row_count, column_count: int) {
- if 0 <= row_index && row_index < row_count &&
- 0 <= column_index && column_index < column_count {
+ if uint(row_index) < uint(row_count) &&
+ uint(column_index) < uint(column_count) {
return
}
@(cold)