Use uint instead of int to improve code generation for bounds checking
This commit is contained in:
1 parent
35e70f4be1
commit
c4d19dfa92
5 files changed
+9
-12
No files matched your search
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user