Skip to content

Commit 06603c1

Browse files
committed
[SE-0101] .size to .stride
1 parent c6f4bcd commit 06603c1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

stdlib/public/SDK/Dispatch/Data.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ public struct DispatchData : RandomAccessCollection, _ObjectiveCBridgeable {
114114
///
115115
/// - parameter buffer: The buffer of bytes to append. The size is calculated from `SourceType` and `buffer.count`.
116116
public mutating func append<SourceType>(_ buffer : UnsafeBufferPointer<SourceType>) {
117-
buffer.baseAddress!.withMemoryRebound(to: UInt8.self, capacity: buffer.count * MemoryLayout<SourceType>.size) {
118-
self.append($0, count: buffer.count * MemoryLayout<SourceType>.size)
117+
buffer.baseAddress!.withMemoryRebound(to: UInt8.self, capacity: buffer.count * MemoryLayout<SourceType>.stride) {
118+
self.append($0, count: buffer.count * MemoryLayout<SourceType>.stride)
119119
}
120120
}
121121

@@ -167,9 +167,9 @@ public struct DispatchData : RandomAccessCollection, _ObjectiveCBridgeable {
167167
precondition(r.endIndex >= 0)
168168
precondition(r.endIndex <= cnt, "The range is outside the bounds of the data")
169169

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

175175
guard !copyRange.isEmpty else { return 0 }

stdlib/public/SDK/SceneKit/SceneKit.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,10 @@ extension SCNGeometryElement {
170170
fatalError("Expected constant number of indices per primitive")
171171
}
172172
self.init(
173-
data: Data(bytes: indices, count: indexCount * MemoryLayout<IndexType>.size),
173+
data: Data(bytes: indices, count: indexCount * MemoryLayout<IndexType>.stride),
174174
primitiveType: primitiveType,
175175
primitiveCount: primitiveCount,
176-
bytesPerIndex: MemoryLayout<IndexType>.size)
176+
bytesPerIndex: MemoryLayout<IndexType>.stride)
177177
_fixLifetime(indices)
178178
}
179179
}

0 commit comments

Comments
 (0)