Re-add debug-mode overflow check in index(_:,_offsetBy:limit:)

This commit is contained in:
Karoy Lorentey
2022-02-03 11:40:41 -08:00
committed by GitHub
parent a3fdcfa43f
commit 0a82ef8e13

View File

@@ -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