mirror of
https://github.com/apple/swift-collections
synced 2026-11-25 04:37:48 +00:00
[Arrays] Use _assumeNonNegative on capacity properties
I’m not convinced this has a real effect, but.
This commit is contained in:
2 files changed
+10
-6
No files matched your search
@@ -123,11 +123,13 @@ extension DynamicArray /*where Element: Copyable*/ {
|
||||
extension DynamicArray where Element: ~Copyable {
|
||||
@inlinable
|
||||
@inline(__always)
|
||||
public var capacity: Int { _storage.capacity }
|
||||
public var capacity: Int { _assumeNonNegative(_storage.capacity) }
|
||||
|
||||
@inlinable
|
||||
@inline(__always)
|
||||
public var freeCapacity: Int { _storage.capacity - _storage.count }
|
||||
public var freeCapacity: Int {
|
||||
_assumeNonNegative(_storage.capacity &- _storage.count)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Span creation
|
||||
|
||||
Reference in new issue
Block a user