Skip to content

Commit cb2c58a

Browse files
committed
[stdlib] fix inconsistency with storeBytes on slices
1 parent 41769e1 commit cb2c58a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

stdlib/public/core/UnsafeBufferPointerSlice.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,11 @@ extension Slice where Base == UnsafeMutableRawBufferPointer {
410410
/// with `type`.
411411
@inlinable
412412
@_alwaysEmitIntoClient
413-
public func storeBytes<T>(of value: T, as type: T.Type) {
413+
public func storeBytes<T>(
414+
of value: T, toByteOffset offset: Int = 0, as type: T.Type
415+
) {
414416
let buffer = Base(rebasing: self)
415-
buffer.storeBytes(of: value, toByteOffset: 0, as: T.self)
417+
buffer.storeBytes(of: value, toByteOffset: offset, as: T.self)
416418
}
417419
}
418420

0 commit comments

Comments
 (0)