Skip to content

Commit 329b8ed

Browse files
committed
perf: optimize euc-jp a bit
1 parent 23fed09 commit 329b8ed

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fallback/multi-byte.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,17 @@ const mappers = {
8686
let i = start
8787

8888
if (lead && i < end) res += decodeLead(arr[i++])
89+
if (lead && i < end) res += decodeLead(arr[i++]) // could be two leads, but no more
8990
while (i < end) {
9091
const b = arr[i++]
91-
if (lead) {
92-
res += decodeLead(b)
93-
} else if (b < 128) {
92+
if (b < 128) {
9493
res += String.fromCharCode(b)
9594
} else if ((b < 0xa1 && b !== 0x8e && b !== 0x8f) || b === 0xff) {
9695
res += String.fromCharCode(err())
9796
} else {
9897
lead = b
9998
if (i < end) res += decodeLead(arr[i++])
99+
if (lead && i < end) res += decodeLead(arr[i++]) // could be two leads
100100
}
101101
}
102102

0 commit comments

Comments
 (0)