Skip to content

Commit fae8166

Browse files
committed
[SE-0101] .size to .stride
1 parent 52af7cd commit fae8166

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/swift/Data.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public struct DispatchData : RandomAccessCollection {
118118
///
119119
/// - parameter buffer: The buffer of bytes to append. The size is calculated from `SourceType` and `buffer.count`.
120120
public mutating func append<SourceType>(_ buffer : UnsafeBufferPointer<SourceType>) {
121-
self.append(UnsafePointer(buffer.baseAddress!), count: buffer.count * MemoryLayout<SourceType>.size)
121+
self.append(UnsafePointer(buffer.baseAddress!), count: buffer.count * MemoryLayout<SourceType>.stride)
122122
}
123123

124124
private func _copyBytesHelper(to pointer: UnsafeMutablePointer<UInt8>, from range: CountableRange<Index>) {
@@ -169,9 +169,9 @@ public struct DispatchData : RandomAccessCollection {
169169
precondition(r.endIndex >= 0)
170170
precondition(r.endIndex <= cnt, "The range is outside the bounds of the data")
171171

172-
copyRange = r.startIndex..<(r.startIndex + Swift.min(buffer.count * MemoryLayout<DestinationType>.size, r.count))
172+
copyRange = r.startIndex..<(r.startIndex + Swift.min(buffer.count * MemoryLayout<DestinationType>.stride, r.count))
173173
} else {
174-
copyRange = 0..<Swift.min(buffer.count * MemoryLayout<DestinationType>.size, cnt)
174+
copyRange = 0..<Swift.min(buffer.count * MemoryLayout<DestinationType>.stride, cnt)
175175
}
176176

177177
guard !copyRange.isEmpty else { return 0 }

0 commit comments

Comments
 (0)