Skip to content

Commit ee1713c

Browse files
committed
[Standard library] Break up another “large” expression.
Bitwise arithmetic is a killer for the type checker :(. Shave off another half second of typecheck time in the standard library.
1 parent 6ffcbc5 commit ee1713c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

stdlib/public/core/UTF16.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ extension Unicode.UTF16 : Unicode.Encoding {
6060
return Unicode.Scalar(_unchecked: bits & 0xffff)
6161
}
6262
_sanityCheck(source._bitCount == 32)
63-
let value = 0x10000 + (bits >> 16 & 0x03ff | (bits & 0x03ff) << 10)
63+
let lower: UInt32 = bits >> 16 & 0x03ff
64+
let upper: UInt32 = (bits & 0x03ff) << 10
65+
let value = 0x10000 + (lower | upper)
6466
return Unicode.Scalar(_unchecked: value)
6567
}
6668

0 commit comments

Comments
 (0)