Fix constant bounds checking for slicing

This commit is contained in:
Ginger Bill
2017-04-22 09:40:32 +01:00
parent 91ed51ff5c
commit 0ea815db49
5 changed files with 22 additions and 26 deletions
+4 -4
View File
@@ -21,12 +21,12 @@ parse_bool :: proc(s: string) -> (result: bool, ok: bool) {
_digit_value :: proc(r: rune) -> (int) {
ri := cast(int)r;
v: int = 16;
match {
case '0' <= r && r <= '9':
match r {
case '0'..'9':
v = ri - '0';
case 'a' <= r && r <= 'z':
case 'a'..'z':
v = ri - 'a' + 10;
case 'A' <= r && r <= 'Z':
case 'A'..'Z':
v = ri - 'A' + 10;
}
return v;