@@ -721,7 +721,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
721
721
return Int ( length)
722
722
}
723
723
set ( newValue) {
724
- precondition ( newValue <= MemoryLayout< Buffer> . size)
724
+ assert ( newValue <= MemoryLayout< Buffer> . size)
725
725
length = UInt8 ( newValue)
726
726
}
727
727
}
@@ -810,7 +810,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
810
810
assert ( subrange. upperBound <= MemoryLayout< Buffer> . size)
811
811
assert ( count - ( subrange. upperBound - subrange. lowerBound) + replacementLength <= MemoryLayout< Buffer> . size)
812
812
precondition ( subrange. lowerBound <= length, " index \( subrange. lowerBound) is out of bounds of 0..< \( length) " )
813
- precondition ( subrange. upperBound <= length, " index \( subrange. lowerBound ) is out of bounds of 0..< \( length) " )
813
+ precondition ( subrange. upperBound <= length, " index \( subrange. upperBound ) is out of bounds of 0..< \( length) " )
814
814
let currentLength = count
815
815
let resultingLength = currentLength - ( subrange. upperBound - subrange. lowerBound) + replacementLength
816
816
let shift = resultingLength - currentLength
@@ -2223,7 +2223,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
2223
2223
2224
2224
@inlinable // This is @inlinable as trivially forwarding.
2225
2225
internal func _copyBytesHelper( to pointer: UnsafeMutableRawPointer , from range: Range < Int > ) {
2226
- if range. upperBound - range . lowerBound == 0 { return }
2226
+ if range. isEmpty { return }
2227
2227
_representation. copyBytes ( to: pointer, from: range)
2228
2228
}
2229
2229
0 commit comments