Merge pull request #355 from jrose-apple/appending-doom
Simplify DispatchData.append(_: UnsafeBufferPointer<T>)
diff --git a/src/swift/Data.swift b/src/swift/Data.swift
index cc85a08..37b4463 100644
--- a/src/swift/Data.swift
+++ b/src/swift/Data.swift
@@ -168,10 +168,7 @@
///
/// - parameter buffer: The buffer of bytes to append. The size is calculated from `SourceType` and `buffer.count`.
public mutating func append<SourceType>(_ buffer : UnsafeBufferPointer<SourceType>) {
- let count = buffer.count * MemoryLayout<SourceType>.stride;
- buffer.baseAddress?.withMemoryRebound(to: UInt8.self, capacity: count) {
- self.append($0, count: count)
- }
+ self.append(UnsafeRawBufferPointer(buffer))
}
private func _copyBytesHelper(to pointer: UnsafeMutableRawPointer, from range: Range<Index>) {