Skip to content

Commit 55a3833

Browse files
committed
wording
1 parent 76e5b6e commit 55a3833

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/utils/utf8.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@ export function utf8Decode(bytes: Uint8Array, inputOffset: number, byteLength: n
121121
const byte2 = bytes[offset++] & 0x3f;
122122
const byte3 = bytes[offset++] & 0x3f;
123123
const byte4 = bytes[offset++] & 0x3f;
124-
let codepoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0c) | (byte3 << 0x06) | byte4;
125-
if (codepoint > 0xffff) {
126-
codepoint -= 0x10000;
127-
out.push(((codepoint >>> 10) & 0x3ff) | 0xd800);
128-
codepoint = 0xdc00 | (codepoint & 0x3ff);
124+
let unit = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0c) | (byte3 << 0x06) | byte4;
125+
if (unit > 0xffff) {
126+
unit -= 0x10000;
127+
out.push(((unit >>> 10) & 0x3ff) | 0xd800);
128+
unit = 0xdc00 | (unit & 0x3ff);
129129
}
130-
out.push(codepoint);
130+
out.push(unit);
131131
} else {
132132
out.push(byte1);
133133
}

0 commit comments

Comments
 (0)