Skip to content

Commit 7770d04

Browse files
authored
Merge pull request #78 from josharian/josh/optimize-intable
add early exit to inTable
2 parents f53b71c + 0ba7fad commit 7770d04

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

runewidth.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ func inTable(r rune, t table) bool {
6464
if r < t[0].first {
6565
return false
6666
}
67+
if r > t[len(t)-1].last {
68+
return false
69+
}
6770

6871
bot := 0
6972
top := len(t) - 1

0 commit comments

Comments
 (0)