Optimize variables

This commit is contained in:
Masaaki Goshima 2021-12-27 22:40:43 +09:00
parent 2d022aa037
commit 1bb8b16200
No known key found for this signature in database
GPG Key ID: 6A53785055537153
1 changed files with 4 additions and 4 deletions

View File

@ -51,8 +51,7 @@ type acceptRange struct {
hi uint8 // highest value for second byte.
}
var (
sep = [2]byte{226, 128}
const (
lineSep = byte(168) //'\u2028'
paragraphSep = byte(169) //'\u2029'
)
@ -109,8 +108,9 @@ func decodeRuneInString(s string) (decodeRuneState, int) {
return runeErrorState, 1
}
if sz <= 3 {
if s[0] == sep[0] && s[1] == sep[1] {
switch s[2] {
// separator character prefixes: [2]byte{226, 128}
if s0 == 226 && s1 == 128 {
switch s2 {
case lineSep:
return lineSepState, 3
case paragraphSep: