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
+3 -3
View File
@@ -39,12 +39,12 @@ encode :: proc(d: []u16, s: []rune) {
n = 0;
for r in s {
match {
case 0 <= r && r < _surr1, _surr3 <= r && r < _surr_self:
match r {
case 0..<_surr1, _surr3..<_surr_self:
d[n] = cast(u16)r;
n++;
case _surr_self <= r && r <= MAX_RUNE:
case _surr_self..MAX_RUNE:
r1, r2 := encode_surrogate_pair(r);
d[n] = cast(u16)r1;
d[n+1] = cast(u16)r2;