Skip to content

Commit 8eea642

Browse files
authored
Merge pull request swiftlang#39824 from glessard/urbp-copycontents-optimization
[stdlib] a minor optimization
2 parents 8259242 + 4d05b75 commit 8eea642

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/public/core/UnsafeRawBufferPointer.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ extension Unsafe${Mutable}RawBufferPointer: Sequence {
181181
}
182182
let destinationAddress = destination.baseAddress._unsafelyUnwrappedUnchecked
183183
let d = UnsafeMutableRawPointer(destinationAddress)
184-
let n = Swift.min(destination.count, self.count)
184+
let n = Swift.min(destination.count, s.distance(to: e))
185185
d.copyMemory(from: s, byteCount: n)
186186
return (Iterator(_position: s.advanced(by: n), _end: e), n)
187187
}

0 commit comments

Comments
 (0)