Skip to content

Commit e804e55

Browse files
committed
Fix thinko
1 parent 0b10cc5 commit e804e55

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

stdlib/public/core/ArrayBuffer.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ extension _ArrayBuffer {
232232
_uninitializedCount: c, minimumCapacity: newCapacity)
233233
let destStart = newBuffer.mutableFirstElementAddress
234234
let destTailStart = destStart + hole.upperBound
235+
let sourceTailStart = firstElementAddress + hole.upperBound
235236
let beforeHole = 0 ..< hole.lowerBound
236237
let afterHole = hole.upperBound ..< c
237238

@@ -243,7 +244,7 @@ extension _ArrayBuffer {
243244
count: beforeHole.count)
244245
}
245246
if !afterHole.isEmpty {
246-
destStart.moveInitialize(from: destTailStart,
247+
destTailStart.moveInitialize(from: sourceTailStart
247248
count: afterHole.count)
248249
}
249250
_native.mutableCount = 0

stdlib/public/core/ContiguousArrayBuffer.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,7 @@ internal struct _ContiguousArrayBuffer<Element>: _ArrayBufferProtocol {
923923
_uninitializedCount: c, minimumCapacity: newCapacity)
924924
let destStart = newBuffer.mutableFirstElementAddress
925925
let destTailStart = destStart + hole.upperBound
926+
let sourceTailStart = firstElementAddress + hole.upperBound
926927
let beforeHole = 0 ..< hole.lowerBound
927928
let afterHole = hole.upperBound ..< c
928929

@@ -934,7 +935,7 @@ internal struct _ContiguousArrayBuffer<Element>: _ArrayBufferProtocol {
934935
count: beforeHole.count)
935936
}
936937
if !afterHole.isEmpty {
937-
destStart.moveInitialize(from: destTailStart,
938+
destTailStart.moveInitialize(from: sourceTailStart,
938939
count: afterHole.count)
939940
}
940941
mutableCount = 0

0 commit comments

Comments
 (0)