Skip to content

Commit 60d7ff8

Browse files
committed
[stdlib] Used storeRaw for constrained storeBytes.
Implement the overload of storeBytes where value is constrained to BitwiseCopyable via Builtin.storeRaw.
1 parent 3f729c9 commit 60d7ff8

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

stdlib/public/core/UnsafeRawPointer.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,12 +1316,7 @@ public struct UnsafeMutableRawPointer: _Pointer {
13161316
public func storeBytes<T : _BitwiseCopyable>(
13171317
of value: T, toByteOffset offset: Int = 0, as type: T.Type
13181318
) {
1319-
withUnsafePointer(to: value) { source in
1320-
_memcpy(
1321-
dest: (self + offset),
1322-
src: source,
1323-
size: UInt(MemoryLayout<T>.size))
1324-
}
1319+
Builtin.storeRaw(value, (self + offset)._rawValue)
13251320
}
13261321
#endif
13271322
@inlinable

0 commit comments

Comments
 (0)