File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -177,14 +177,19 @@ extension _ArrayBufferProtocol {
177
177
178
178
// place the values into the hole we created
179
179
if newCount > 0 {
180
- var place = holeStart
181
- var i = newValues. startIndex
182
- while place < holeEnd {
183
- place. initialize ( to: newValues [ i] )
184
- place += 1
185
- newValues. formIndex ( after: & i)
180
+ let done : Void ? = newValues. withContiguousStorageIfAvailable {
181
+ holeStart. initialize ( from: $0. baseAddress!, count: newCount)
182
+ }
183
+ if done == nil {
184
+ var place = holeStart
185
+ var i = newValues. startIndex
186
+ while place < holeEnd {
187
+ place. initialize ( to: newValues [ i] )
188
+ place += 1
189
+ newValues. formIndex ( after: & i)
190
+ }
191
+ _expectEnd ( of: newValues, is: i)
186
192
}
187
- _expectEnd ( of: newValues, is: i)
188
193
}
189
194
}
190
195
}
You can’t perform that action at this time.
0 commit comments