mirror of
https://github.com/apple/swift-collections
synced 2026-11-25 04:37:48 +00:00
Merge pull request #570 from lorentey/remove-outputspan-workaround
Remove workaround for bug in OutputSpan.wUMBP
This commit is contained in:
13 files changed
+27
-62
No files matched your search
@@ -169,7 +169,7 @@ extension RigidDeque where Element: ~Copyable {
|
||||
public mutating func append(
|
||||
moving items: inout OutputSpan<Element>
|
||||
) {
|
||||
items._withUnsafeMutableBufferPointer { buffer, count in
|
||||
items.withUnsafeMutableBufferPointer { buffer, count in
|
||||
let source = buffer._extracting(first: count)
|
||||
unsafe self.append(moving: source)
|
||||
count = 0
|
||||
|
||||
@@ -134,7 +134,7 @@ extension RigidDeque where Element: ~Copyable {
|
||||
guard !items.isEmpty else { return }
|
||||
var remainder = items
|
||||
insert(addingCount: items.count, at: index) { target in
|
||||
target._withUnsafeMutableBufferPointer { buffer, count in
|
||||
target.withUnsafeMutableBufferPointer { buffer, count in
|
||||
buffer.moveInitializeAll(
|
||||
fromContentsOf: remainder._trim(first: buffer.count))
|
||||
count = buffer.count
|
||||
@@ -196,7 +196,7 @@ extension RigidDeque where Element: ~Copyable {
|
||||
moving items: inout OutputSpan<Element>,
|
||||
at index: Int
|
||||
) {
|
||||
items._withUnsafeMutableBufferPointer { buffer, count in
|
||||
items.withUnsafeMutableBufferPointer { buffer, count in
|
||||
let source = buffer._extracting(first: count)
|
||||
unsafe self.insert(moving: source, at: index)
|
||||
count = 0
|
||||
@@ -282,7 +282,7 @@ extension RigidDeque /* where Element: Copyable */ {
|
||||
guard items.count > 0 else { return }
|
||||
var remainder = items
|
||||
insert(addingCount: remainder.count, at: index) { target in
|
||||
target._withUnsafeMutableBufferPointer { buffer, count in
|
||||
target.withUnsafeMutableBufferPointer { buffer, count in
|
||||
buffer.initializeAll(
|
||||
fromContentsOf: remainder._extracting(first: buffer.count))
|
||||
remainder = remainder._extracting(droppingFirst: buffer.count)
|
||||
|
||||
@@ -173,7 +173,7 @@ extension RigidDeque where Element: ~Copyable {
|
||||
public mutating func prepend(
|
||||
moving items: inout OutputSpan<Element>
|
||||
) {
|
||||
items._withUnsafeMutableBufferPointer { buffer, count in
|
||||
items.withUnsafeMutableBufferPointer { buffer, count in
|
||||
let source = buffer._extracting(first: count)
|
||||
unsafe self.prepend(moving: source)
|
||||
count = 0
|
||||
|
||||
@@ -194,7 +194,7 @@ extension RigidDeque where Element: ~Copyable {
|
||||
) {
|
||||
var remainder = items
|
||||
replace(removing: subrange, addingCount: remainder.count) { target in
|
||||
target._withUnsafeMutableBufferPointer { buffer, count in
|
||||
target.withUnsafeMutableBufferPointer { buffer, count in
|
||||
buffer.moveInitializeAll(
|
||||
fromContentsOf: remainder._trim(first: buffer.count))
|
||||
count = buffer.count
|
||||
@@ -274,7 +274,7 @@ extension RigidDeque where Element: ~Copyable {
|
||||
removing subrange: Range<Int>,
|
||||
moving items: inout OutputSpan<Element>
|
||||
) {
|
||||
items._withUnsafeMutableBufferPointer { buffer, count in
|
||||
items.withUnsafeMutableBufferPointer { buffer, count in
|
||||
let source = buffer._extracting(first: count)
|
||||
unsafe self.replace(removing: subrange, moving: source)
|
||||
count = 0
|
||||
@@ -372,7 +372,7 @@ extension RigidDeque /* where Element: Copyable */ {
|
||||
) {
|
||||
var remainder = items
|
||||
replace(removing: subrange, addingCount: remainder.count) { target in
|
||||
target._withUnsafeMutableBufferPointer { dst, dstCount in
|
||||
target.withUnsafeMutableBufferPointer { dst, dstCount in
|
||||
dst.initializeAll(fromContentsOf: remainder._trim(first: dst.count))
|
||||
dstCount += dst.count
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
public mutating func append(
|
||||
moving items: inout OutputSpan<Element>
|
||||
) {
|
||||
items._withUnsafeMutableBufferPointer { buffer, count in
|
||||
items.withUnsafeMutableBufferPointer { buffer, count in
|
||||
let source = buffer._extracting(first: count)
|
||||
unsafe self.append(moving: source)
|
||||
count = 0
|
||||
|
||||
@@ -140,7 +140,7 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
guard !items.isEmpty else { return }
|
||||
var remainder = items
|
||||
insert(addingCount: items.count, at: index) { target in
|
||||
target._withUnsafeMutableBufferPointer { buffer, count in
|
||||
target.withUnsafeMutableBufferPointer { buffer, count in
|
||||
buffer.moveInitializeAll(
|
||||
fromContentsOf: remainder._trim(first: buffer.count))
|
||||
count = buffer.count
|
||||
@@ -206,7 +206,7 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
moving items: inout OutputSpan<Element>,
|
||||
at index: Int
|
||||
) {
|
||||
items._withUnsafeMutableBufferPointer { buffer, count in
|
||||
items.withUnsafeMutableBufferPointer { buffer, count in
|
||||
let source = buffer._extracting(first: count)
|
||||
unsafe self.insert(moving: source, at: index)
|
||||
count = 0
|
||||
@@ -296,7 +296,7 @@ extension UniqueDeque /* where Element: Copyable */ {
|
||||
guard items.count > 0 else { return }
|
||||
var remainder = items
|
||||
insert(addingCount: remainder.count, at: index) { target in
|
||||
target._withUnsafeMutableBufferPointer { buffer, count in
|
||||
target.withUnsafeMutableBufferPointer { buffer, count in
|
||||
buffer.initializeAll(
|
||||
fromContentsOf: remainder._extracting(first: buffer.count))
|
||||
remainder = remainder._extracting(droppingFirst: buffer.count)
|
||||
|
||||
@@ -164,7 +164,7 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
public mutating func prepend(
|
||||
moving items: inout OutputSpan<Element>
|
||||
) {
|
||||
items._withUnsafeMutableBufferPointer { buffer, count in
|
||||
items.withUnsafeMutableBufferPointer { buffer, count in
|
||||
let source = buffer._extracting(first: count)
|
||||
unsafe self.prepend(moving: source)
|
||||
count = 0
|
||||
|
||||
@@ -200,7 +200,7 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
) {
|
||||
var remainder = items
|
||||
replaceSubrange(subrange, addingCount: remainder.count) { target in
|
||||
target._withUnsafeMutableBufferPointer { buffer, count in
|
||||
target.withUnsafeMutableBufferPointer { buffer, count in
|
||||
buffer.moveInitializeAll(
|
||||
fromContentsOf: remainder._trim(first: buffer.count))
|
||||
count = buffer.count
|
||||
@@ -282,7 +282,7 @@ extension UniqueDeque where Element: ~Copyable {
|
||||
_ subrange: Range<Int>,
|
||||
moving items: inout OutputSpan<Element>
|
||||
) {
|
||||
items._withUnsafeMutableBufferPointer { buffer, count in
|
||||
items.withUnsafeMutableBufferPointer { buffer, count in
|
||||
let source = buffer._extracting(first: count)
|
||||
unsafe self.replaceSubrange(subrange, moving: source)
|
||||
count = 0
|
||||
@@ -381,7 +381,7 @@ extension UniqueDeque /* where Element: Copyable */ {
|
||||
) {
|
||||
var remainder = items
|
||||
replaceSubrange(subrange, addingCount: remainder.count) { target in
|
||||
target._withUnsafeMutableBufferPointer { dst, dstCount in
|
||||
target.withUnsafeMutableBufferPointer { dst, dstCount in
|
||||
dst.initializeAll(fromContentsOf: remainder._trim(first: dst.count))
|
||||
dstCount += dst.count
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user