We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d051a8b commit ae657d7Copy full SHA for ae657d7
src/swift/Data.swift
@@ -130,7 +130,7 @@ public struct DispatchData : RandomAccessCollection {
130
///
131
/// - parameter buffer: The buffer of bytes to append. The size is calculated from `SourceType` and `buffer.count`.
132
public mutating func append<SourceType>(_ buffer : UnsafeBufferPointer<SourceType>) {
133
- let count = buffer.count * sizeof(SourceType.self)
+ let count = buffer.count * MemoryLayout<SourceType>.stride;
134
buffer.baseAddress?.withMemoryRebound(to: UInt8.self, capacity: count) {
135
self.append($0, count: count)
136
}
0 commit comments