Skip to content

Commit a2cd889

Browse files
committed
[Stdlib] Fix botched merge conflict resolution in Data.swift.
1 parent e07e1db commit a2cd889

File tree

1 file changed

+5
-105
lines changed

1 file changed

+5
-105
lines changed

stdlib/public/Darwin/Foundation/Data.swift

Lines changed: 5 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -299,43 +299,7 @@ internal final class __DataStorage {
299299
__DataStorage.move(_bytes!.advanced(by: origLength), bytes, length)
300300
}
301301

302-
<<<<<<< HEAD
303-
@inlinable // This is @inlinable despite escaping the _DataStorage boundary layer because it is trivially computed.
304-
=======
305-
// fast-path for appending directly from another data storage
306-
@inlinable
307-
func append(_ otherData: __DataStorage, startingAt start: Int, endingAt end: Int) {
308-
let otherLength = otherData.length
309-
if otherLength == 0 { return }
310-
if let bytes = otherData.bytes {
311-
append(bytes.advanced(by: start), length: end - start)
312-
}
313-
}
314-
315-
@inlinable
316-
func append(_ otherData: Data) {
317-
guard otherData.count > 0 else { return }
318-
otherData.withUnsafeBytes {
319-
append($0.baseAddress!, length: $0.count)
320-
}
321-
}
322-
323-
@inlinable
324-
func increaseLength(by extraLength: Int) {
325-
if extraLength == 0 { return }
326-
327-
let origLength = _length
328-
let newLength = origLength + extraLength
329-
if _capacity < newLength || _bytes == nil {
330-
ensureUniqueBufferReference(growingTo: newLength, clear: true)
331-
} else if _needToZero {
332-
memset(_bytes!.advanced(by: origLength), 0, extraLength)
333-
}
334-
_length = newLength
335-
}
336-
337-
@inlinable
338-
>>>>>>> [Stdlib][Overlays] Rename various classes to avoid conflicting ObjC names.
302+
@inlinable // This is @inlinable despite escaping the __DataStorage boundary layer because it is trivially computed.
339303
func get(_ index: Int) -> UInt8 {
340304
return _bytes!.advanced(by: index - _offset).assumingMemoryBound(to: UInt8.self).pointee
341305
}
@@ -352,27 +316,7 @@ internal final class __DataStorage {
352316
UnsafeMutableRawBufferPointer(start: pointer, count: range.upperBound - range.lowerBound).copyMemory(from: offsetPointer)
353317
}
354318

355-
<<<<<<< HEAD
356319
@usableFromInline // This is not @inlinable as it is a non-trivial, non-generic function.
357-
=======
358-
@inlinable
359-
func replaceBytes(in range: NSRange, with bytes: UnsafeRawPointer?) {
360-
if range.length == 0 { return }
361-
if _length < range.location + range.length {
362-
let newLength = range.location + range.length
363-
if _capacity < newLength {
364-
ensureUniqueBufferReference(growingTo: newLength, clear: false)
365-
}
366-
_length = newLength
367-
} else {
368-
ensureUniqueBufferReference()
369-
}
370-
__DataStorage.move(_bytes!.advanced(by: range.location - _offset), bytes!, range.length)
371-
372-
}
373-
374-
@inlinable
375-
>>>>>>> [Stdlib][Overlays] Rename various classes to avoid conflicting ObjC names.
376320
func replaceBytes(in range_: NSRange, with replacementBytes: UnsafeRawPointer?, length replacementLength: Int) {
377321
let range = NSRange(location: range_.location - _offset, length: range_.length)
378322
let currentLength = _length
@@ -576,15 +520,9 @@ internal final class __DataStorage {
576520
_freeBytes()
577521
}
578522

579-
<<<<<<< HEAD
580-
@inlinable // This is @inlinable despite escaping the _DataStorage boundary layer because it is trivially computed.
581-
func mutableCopy(_ range: Range<Int>) -> _DataStorage {
582-
return _DataStorage(bytes: _bytes?.advanced(by: range.lowerBound - _offset), length: range.upperBound - range.lowerBound, copy: true, deallocator: nil, offset: range.lowerBound)
583-
=======
584-
@inlinable
523+
@inlinable // This is @inlinable despite escaping the __DataStorage boundary layer because it is trivially computed.
585524
func mutableCopy(_ range: Range<Int>) -> __DataStorage {
586525
return __DataStorage(bytes: _bytes?.advanced(by: range.lowerBound - _offset), length: range.upperBound - range.lowerBound, copy: true, deallocator: nil, offset: range.lowerBound)
587-
>>>>>>> [Stdlib][Overlays] Rename various classes to avoid conflicting ObjC names.
588526
}
589527

590528
@inlinable // This is @inlinable despite escaping the _DataStorage boundary layer because it is generic and trivially computed.
@@ -905,15 +843,8 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
905843
internal struct InlineSlice {
906844
// ***WARNING***
907845
// These ivars are specifically laid out so that they cause the enum _Representation to be 16 bytes on 64 bit platforms. This means we _MUST_ have the class type thing last
908-
<<<<<<< HEAD
909846
@usableFromInline var slice: Range<HalfInt>
910-
@usableFromInline var storage: _DataStorage
911-
=======
912-
@usableFromInline
913-
var slice: Range<HalfInt>
914-
@usableFromInline
915-
var storage: __DataStorage
916-
>>>>>>> [Stdlib][Overlays] Rename various classes to avoid conflicting ObjC names.
847+
@usableFromInline var storage: __DataStorage
917848

918849
@inlinable // This is @inlinable as trivially computable.
919850
static func canStore(count: Int) -> Bool {
@@ -965,25 +896,15 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
965896
self.init(large.storage, range: range)
966897
}
967898

968-
<<<<<<< HEAD
969899
@inlinable // This is @inlinable as a trivial initializer.
970-
init(_ storage: _DataStorage, count: Int) {
971-
=======
972-
@inlinable
973900
init(_ storage: __DataStorage, count: Int) {
974-
>>>>>>> [Stdlib][Overlays] Rename various classes to avoid conflicting ObjC names.
975901
assert(count < HalfInt.max)
976902
self.storage = storage
977903
slice = 0..<HalfInt(count)
978904
}
979905

980-
<<<<<<< HEAD
981906
@inlinable // This is @inlinable as a trivial initializer.
982-
init(_ storage: _DataStorage, range: Range<Int>) {
983-
=======
984-
@inlinable
985907
init(_ storage: __DataStorage, range: Range<Int>) {
986-
>>>>>>> [Stdlib][Overlays] Rename various classes to avoid conflicting ObjC names.
987908
assert(range.lowerBound < HalfInt.max)
988909
assert(range.upperBound < HalfInt.max)
989910
self.storage = storage
@@ -1168,15 +1089,8 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
11681089
internal struct LargeSlice {
11691090
// ***WARNING***
11701091
// These ivars are specifically laid out so that they cause the enum _Representation to be 16 bytes on 64 bit platforms. This means we _MUST_ have the class type thing last
1171-
<<<<<<< HEAD
11721092
@usableFromInline var slice: RangeReference
1173-
@usableFromInline var storage: _DataStorage
1174-
=======
1175-
@usableFromInline
1176-
var slice: RangeReference
1177-
@usableFromInline
1178-
var storage: __DataStorage
1179-
>>>>>>> [Stdlib][Overlays] Rename various classes to avoid conflicting ObjC names.
1093+
@usableFromInline var storage: __DataStorage
11801094

11811095
@inlinable // This is @inlinable as a convenience initializer.
11821096
init(_ buffer: UnsafeRawBufferPointer) {
@@ -1195,12 +1109,8 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
11951109

11961110
@inlinable // This is @inlinable as a convenience initializer.
11971111
init(_ inline: InlineData) {
1198-
<<<<<<< HEAD
1199-
let storage = inline.withUnsafeBytes { return _DataStorage(bytes: $0.baseAddress, length: $0.count) }
1112+
let storage = inline.withUnsafeBytes { return __DataStorage(bytes: $0.baseAddress, length: $0.count) }
12001113
self.init(storage, count: inline.count)
1201-
=======
1202-
self.init(inline.withUnsafeBytes { return __DataStorage(bytes: $0.baseAddress, length: $0.count) }, count: inline.count)
1203-
>>>>>>> [Stdlib][Overlays] Rename various classes to avoid conflicting ObjC names.
12041114
}
12051115

12061116
@inlinable // This is @inlinable as a trivial initializer.
@@ -1209,13 +1119,8 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
12091119
self.slice = RangeReference(slice.range)
12101120
}
12111121

1212-
<<<<<<< HEAD
12131122
@inlinable // This is @inlinable as a trivial initializer.
1214-
init(_ storage: _DataStorage, count: Int) {
1215-
=======
1216-
@inlinable
12171123
init(_ storage: __DataStorage, count: Int) {
1218-
>>>>>>> [Stdlib][Overlays] Rename various classes to avoid conflicting ObjC names.
12191124
self.storage = storage
12201125
self.slice = RangeReference(0..<count)
12211126
}
@@ -1421,13 +1326,8 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
14211326
}
14221327
}
14231328

1424-
<<<<<<< HEAD
14251329
@inlinable // This is @inlinable as a trivial initializer.
1426-
init(_ storage: _DataStorage, count: Int) {
1427-
=======
1428-
@inlinable
14291330
init(_ storage: __DataStorage, count: Int) {
1430-
>>>>>>> [Stdlib][Overlays] Rename various classes to avoid conflicting ObjC names.
14311331
if count == 0 {
14321332
self = .empty
14331333
} else if InlineData.canStore(count: count) {

0 commit comments

Comments
 (0)