diff options
| author | gingerBill <bill@gingerbill.org> | 2022-09-27 22:31:46 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-09-27 22:31:46 +0100 |
| commit | c4d19dfa925ffe44c04fcda90543a272b7165274 (patch) | |
| tree | c493697ab16154885febf04511f7f61e64b4bbbb /core/strings | |
| parent | 35e70f4be17f4123ec25108d664864f13b38087e (diff) | |
Use `uint` instead of `int` to improve code generation for bounds checking
Diffstat (limited to 'core/strings')
| -rw-r--r-- | core/strings/strings.odin | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/strings/strings.odin b/core/strings/strings.odin index a0f553a68..ba357e027 100644 --- a/core/strings/strings.odin +++ b/core/strings/strings.odin @@ -760,7 +760,7 @@ last_index_byte :: proc(s: string, c: byte) -> int { */ index_rune :: proc(s: string, r: rune) -> int { switch { - case 0 <= r && r < utf8.RUNE_SELF: + case u32(r) < utf8.RUNE_SELF: return index_byte(s, byte(r)) case r == utf8.RUNE_ERROR: |