Skip to content

Commit 58a0c1f

Browse files
committed
perf: ~25% faster utf16.isWellFormed
1 parent a1f6d7a commit 58a0c1f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fallback/utf16.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export function isWellFormed(u16) {
161161
const b = u32[i + 1]
162162
const c = u32[i + 2]
163163
const d = u32[i + 3]
164-
if (a & 0x80_00_80_00 || b & 0x80_00_80_00 || c & 0x80_00_80_00 || d & 0x80_00_80_00) break
164+
if ((a | b | c | d) & 0x80_00_80_00) break
165165
}
166166

167167
for (; i < u32length; i++) if (u32[i] & 0x80_00_80_00) break

0 commit comments

Comments
 (0)