File tree Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -136,8 +136,6 @@ internal enum NormalizationResult {
136
136
}
137
137
}
138
138
139
- func unimplemented( ) -> Never { fatalError ( " Unimplemented function called " ) }
140
-
141
139
internal func fastFill(
142
140
_ sourceBuffer: UnsafeBufferPointer < UInt8 > ,
143
141
_ outputBuffer: UnsafeMutableBufferPointer < UInt8 >
@@ -234,18 +232,14 @@ internal func transcodeToUTF8(
234
232
//a single segment at this point
235
233
236
234
readIndex += length
237
- guard scalar. withUTF8CodeUnits ( { utf8 in
238
- for cu in utf8 {
239
- if writeIndex < outputCount {
240
- outputBuffer [ writeIndex] = cu
241
- writeIndex += 1
242
- } else {
243
- return false
244
- }
235
+
236
+ for cu in UTF8 . encode ( scalar) . _unsafelyUnwrappedUnchecked {
237
+ if writeIndex < outputCount {
238
+ outputBuffer [ writeIndex] = cu
239
+ writeIndex &+= 1
240
+ } else {
241
+ return nil
245
242
}
246
- return true
247
- } ) else {
248
- return nil
249
243
}
250
244
}
251
245
return ( readIndex, writeIndex)
You can’t perform that action at this time.
0 commit comments