Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Sources/ContainersPreview/InputSpan.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ extension InputSpan where Element: ~Copyable {
@unsafe
internal func _first() -> UnsafeMutableRawPointer {
// NOTE: `_pointer` must be known to be not-nil.
unsafe _start().advanced(by: _count &* MemoryLayout<Element>.stride)
// Initialized elements live at the end of the buffer; skip the uninitialized prefix.
let offset = (capacity &- _count) &* MemoryLayout<Element>.stride
unsafe _start().advanced(by: offset)
}

@unsafe
Expand Down