Skip to content

Commit 8145a07

Browse files
rintarodas
authored andcommitted
[SE-0101] .size to .stride
Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
1 parent b6451f2 commit 8145a07

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
@@ -154,7 +154,7 @@ public struct DispatchData : RandomAccessCollection {
154154

155155
/// Copy the contents of the data into a buffer.
156156
///
157-
/// This function copies the bytes in `range` from the data into the buffer. If the count of the `range` is greater than `MemoryLayout<DestinationType>.size * buffer.count` then the first N bytes will be copied into the buffer.
157+
/// This function copies the bytes in `range` from the data into the buffer. If the count of the `range` is greater than `MemoryLayout<DestinationType>.stride * buffer.count` then the first N bytes will be copied into the buffer.
158158
/// - precondition: The range must be within the bounds of the data. Otherwise `fatalError` is called.
159159
/// - parameter buffer: A buffer to copy the data into.
160160
/// - parameter range: A range in the data to copy into the buffer. If the range is empty, this function will return 0 without copying anything. If the range is nil, as much data as will fit into `buffer` is copied.
@@ -172,9 +172,9 @@ public struct DispatchData : RandomAccessCollection {
172172
precondition(r.endIndex >= 0)
173173
precondition(r.endIndex <= cnt, "The range is outside the bounds of the data")
174174

175-
copyRange = r.startIndex..<(r.startIndex + Swift.min(buffer.count * MemoryLayout<DestinationType>.size, r.count))
175+
copyRange = r.startIndex..<(r.startIndex + Swift.min(buffer.count * MemoryLayout<DestinationType>.stride, r.count))
176176
} else {
177-
copyRange = 0..<Swift.min(buffer.count * MemoryLayout<DestinationType>.size, cnt)
177+
copyRange = 0..<Swift.min(buffer.count * MemoryLayout<DestinationType>.stride, cnt)
178178
}
179179

180180
guard !copyRange.isEmpty else { return 0 }

0 commit comments

Comments
 (0)