mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Re-add debug-mode overflow check in index(_:,_offsetBy:limit:)
This commit is contained in:
@@ -221,8 +221,9 @@ extension Unsafe${Mutable}BufferPointer: ${Mutable}Collection, RandomAccessColle
|
||||
return nil
|
||||
}
|
||||
|
||||
// No need to check here, for the same index misuse reasons.
|
||||
return i &+ n
|
||||
let result = i.addingReportingOverflow(n)
|
||||
_debugPrecondition(!result.overflow)
|
||||
return result.partialValue
|
||||
}
|
||||
|
||||
@inlinable // unsafe-performance
|
||||
|
||||
Reference in New Issue
Block a user