Skip to content

Commit eeff8b7

Browse files
authored
Revert "Slices of no copy Data bridged to and back incorrectly account for the start index (#698)" (#712)
This reverts commit 7fa9d1f.
1 parent 88d6a8d commit eeff8b7

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

Sources/FoundationEssentials/Data/Data.swift

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -824,11 +824,6 @@ public struct Data : Equatable, Hashable, RandomAccessCollection, MutableCollect
824824
static func canStore(count: Int) -> Bool {
825825
return count < HalfInt.max
826826
}
827-
828-
@inlinable // This is @inlinable as trivially computable.
829-
static func canStore(range: Range<Int>) -> Bool {
830-
return range.lowerBound < HalfInt.max && range.upperBound < HalfInt.max
831-
}
832827

833828
@inlinable // This is @inlinable as a convenience initializer.
834829
init(_ buffer: UnsafeRawBufferPointer) {
@@ -1132,12 +1127,6 @@ public struct Data : Equatable, Hashable, RandomAccessCollection, MutableCollect
11321127
self.storage = storage
11331128
self.slice = RangeReference(0..<count)
11341129
}
1135-
1136-
@inlinable // This is @inlinable as a trivial initializer.
1137-
init(_ storage: __DataStorage, range: Range<Int>) {
1138-
self.storage = storage
1139-
self.slice = RangeReference(range)
1140-
}
11411130

11421131
@inlinable // This is @inlinable as trivially computable (and inlining may help avoid retain-release traffic).
11431132
mutating func ensureUniqueReference() {
@@ -1380,19 +1369,6 @@ public struct Data : Equatable, Hashable, RandomAccessCollection, MutableCollect
13801369
self = .large(LargeSlice(storage, count: count))
13811370
}
13821371
}
1383-
1384-
@inlinable
1385-
init(_ storage: __DataStorage, range: Range<Int>) {
1386-
if range.count == 0 {
1387-
self = .empty
1388-
} else if range.startIndex == 0 {
1389-
self.init(storage, count: range.count)
1390-
} else if InlineSlice.canStore(range: range) {
1391-
self = .slice(InlineSlice(storage, range: range))
1392-
} else {
1393-
self = .large(LargeSlice(storage, range: range))
1394-
}
1395-
}
13961372

13971373
@usableFromInline // This is not @inlinable as it is a non-trivial, non-generic function.
13981374
mutating func reserveCapacity(_ minimumCapacity: Int) {

0 commit comments

Comments
 (0)