File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -90,10 +90,11 @@ internal struct _HasherTailBuffer {
90
90
internal init ( tail: UInt64 , byteCount: UInt64 ) {
91
91
// byteCount can be any value, but we only keep the lower 8 bits. (The
92
92
// lower three bits specify the count of bytes stored in this buffer.)
93
- // FIXME: The "as UInt64" annotations here eliminate some exponential
93
+ // FIXME: This should be a single expression, but it causes exponential
94
94
// behavior in the expression type checker <rdar://problem/42672946>.
95
- _sanityCheck ( tail & ~ ( ( 1 as UInt64 ) << ( ( byteCount & ( 7 as UInt64 ) )
96
- << ( 3 as UInt64 ) ) - ( 1 as UInt64 ) ) == ( 0 as UInt64 ) )
95
+ let shiftedByteCount : UInt64 = ( ( byteCount & 7 ) << 3 )
96
+ let mask : UInt64 = ( 1 << shiftedByteCount - 1 )
97
+ _sanityCheck ( tail & ~ mask == 0 )
97
98
self . value = ( byteCount &<< 56 | tail)
98
99
}
99
100
Original file line number Diff line number Diff line change @@ -60,7 +60,9 @@ extension Unicode.UTF16 : Unicode.Encoding {
60
60
return Unicode . Scalar ( _unchecked: bits & 0xffff )
61
61
}
62
62
_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)
64
66
return Unicode . Scalar ( _unchecked: value)
65
67
}
66
68
You can’t perform that action at this time.
0 commit comments