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 @@ -173,14 +173,19 @@ extension _ArrayBufferProtocol {
173
173
174
174
// place the values into the hole we created
175
175
if newCount > 0 {
176
- var place = holeStart
177
- var i = newValues. startIndex
178
- while place < holeEnd {
179
- place. initialize ( to: newValues [ i] )
180
- place += 1
181
- newValues. formIndex ( after: & i)
176
+ let done : Void ? = newValues. withContiguousStorageIfAvailable {
177
+ holeStart. initialize ( from: $0. baseAddress!, count: newCount)
178
+ }
179
+ if done == nil {
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)
186
+ }
187
+ _expectEnd ( of: newValues, is: i)
182
188
}
183
- _expectEnd ( of: newValues, is: i)
184
189
}
185
190
}
186
191
}
You can’t perform that action at this time.
0 commit comments