File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ internal func _decodeUTF8(
6464internal func _decodeScalar(
6565 _ utf16: UnsafeBufferPointer < UInt16 > , startingAt i: Int
6666) -> ( Unicode . Scalar , scalarLength: Int ) {
67- let high = utf16 [ i]
67+ let high = utf16 [ _unchecked : i]
6868 if i + 1 >= utf16. count {
6969 _internalInvariant ( !UTF16. isLeadSurrogate ( high) )
7070 _internalInvariant ( !UTF16. isTrailSurrogate ( high) )
@@ -76,7 +76,7 @@ internal func _decodeScalar(
7676 return ( Unicode . Scalar ( _unchecked: UInt32 ( high) ) , 1 )
7777 }
7878
79- let low = utf16 [ i+ 1 ]
79+ let low = utf16 [ _unchecked : i+ 1 ]
8080 _internalInvariant ( UTF16 . isLeadSurrogate ( high) )
8181 _internalInvariant ( UTF16 . isTrailSurrogate ( low) )
8282 return ( UTF16 . _decodeSurrogates ( high, low) , 2 )
@@ -207,7 +207,7 @@ extension _StringGuts {
207207 @inlinable
208208 internal func fastUTF8ScalarLength( startingAt i: Int ) -> Int {
209209 _internalInvariant ( isFastUTF8)
210- let len = _utf8ScalarLength ( self . withFastUTF8 { $0 [ i] } )
210+ let len = _utf8ScalarLength ( self . withFastUTF8 { $0 [ _unchecked : i] } )
211211 _internalInvariant ( ( 1 ... 4 ) ~= len)
212212 return len
213213 }
You can’t perform that action at this time.
0 commit comments