mirror of
https://github.com/apple/swift-collections
synced 2026-11-28 05:04:21 +00:00
maximumCount → maxCount
While we’re here, adjust `RigidSet.insert(maximumCount:initializingWith:)` and similar APIs to be consistent with RangeReplaceableContainer’s methods.
This commit is contained in:
64 files changed
+505
-275
No files matched your search
@@ -0,0 +1,63 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Collections open source project
|
||||
//
|
||||
// Copyright (c) 2026 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH Swift-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if COLLECTIONS_SINGLE_MODULE
|
||||
|
||||
#if compiler(>=6.2)
|
||||
extension _HTable.BucketIterator {
|
||||
// FIXME: Remove after 27.0 releases
|
||||
@available(*, deprecated, renamed: "advanceToOccupied(maxCount:)")
|
||||
@usableFromInline
|
||||
@discardableResult
|
||||
@_lifetime(self: copy self)
|
||||
internal mutating func advanceToOccupied(
|
||||
maximumCount: Int
|
||||
) -> Bool {
|
||||
self.advanceToOccupied(maxCount: maximumCount)
|
||||
}
|
||||
|
||||
// FIXME: Remove after 27.0 releases
|
||||
@available(*, deprecated, renamed: "advanceToUnoccupied(maxCount:)")
|
||||
@usableFromInline
|
||||
@discardableResult
|
||||
@_lifetime(self: copy self)
|
||||
internal mutating func advanceToUnoccupied(
|
||||
maximumCount: Int
|
||||
) -> Bool {
|
||||
self.advanceToUnoccupied(maxCount: maximumCount)
|
||||
}
|
||||
|
||||
// FIXME: Remove after 27.0 releases
|
||||
@available(*, deprecated, renamed: "nextOccupiedRegion(maxCount:)")
|
||||
@usableFromInline
|
||||
@_lifetime(self: copy self)
|
||||
internal mutating func nextOccupiedRegion(
|
||||
maximumCount: Int
|
||||
) -> Range<Bucket>? {
|
||||
self.nextOccupiedRegion(maxCount: maximumCount)
|
||||
}
|
||||
|
||||
// FIXME: Remove after 27.0 releases
|
||||
@available(*, deprecated, renamed: "nextUnoccupiedRegion(maxCount:)")
|
||||
@usableFromInline
|
||||
@_lifetime(self: copy self)
|
||||
internal mutating func nextUnoccupiedRegion(
|
||||
maximumCount: Int
|
||||
) -> Range<Bucket>? {
|
||||
self.nextUnoccupiedRegion(maxCount: maximumCount)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -232,9 +232,9 @@ extension _HTable.BucketIterator {
|
||||
@discardableResult
|
||||
@_lifetime(self: copy self)
|
||||
package mutating func advanceToOccupied(
|
||||
maximumCount: Int
|
||||
maxCount: Int
|
||||
) -> Bool {
|
||||
var remainder = UInt(bitPattern: maximumCount)
|
||||
var remainder = UInt(bitPattern: maxCount)
|
||||
if isAtEnd { return false }
|
||||
if _words == nil {
|
||||
let delta = Swift.min(_endBucket._offset &- _bucket._offset, remainder)
|
||||
@@ -309,11 +309,11 @@ extension _HTable.BucketIterator {
|
||||
@discardableResult
|
||||
@_lifetime(self: copy self)
|
||||
package mutating func advanceToUnoccupied(
|
||||
maximumCount: Int
|
||||
maxCount: Int
|
||||
) -> Bool {
|
||||
assert(maximumCount > 0)
|
||||
assert(maxCount > 0)
|
||||
assert(!isAtEnd)
|
||||
var remainder = UInt(bitPattern: maximumCount)
|
||||
var remainder = UInt(bitPattern: maxCount)
|
||||
if _words == nil {
|
||||
let delta = Swift.min(_endBucket._offset &- _bucket._offset, remainder)
|
||||
_bucket._offset &+= delta
|
||||
@@ -363,13 +363,13 @@ extension _HTable.BucketIterator {
|
||||
@usableFromInline
|
||||
@_lifetime(self: copy self)
|
||||
package mutating func nextOccupiedRegion(
|
||||
maximumCount: Int = .max
|
||||
maxCount: Int = .max
|
||||
) -> Range<Bucket>? {
|
||||
assert(maximumCount > 0)
|
||||
assert(maxCount > 0)
|
||||
guard self.advanceToOccupied() else { return nil }
|
||||
assert(self.isOccupied)
|
||||
let start = self.currentBucket
|
||||
self.advanceToUnoccupied(maximumCount: maximumCount)
|
||||
self.advanceToUnoccupied(maxCount: maxCount)
|
||||
let end = self.currentBucket
|
||||
return Range(uncheckedBounds: (start, end))
|
||||
}
|
||||
@@ -377,13 +377,13 @@ extension _HTable.BucketIterator {
|
||||
@usableFromInline
|
||||
@_lifetime(self: copy self)
|
||||
package mutating func nextUnoccupiedRegion(
|
||||
maximumCount: Int = .max
|
||||
maxCount: Int = .max
|
||||
) -> Range<Bucket>? {
|
||||
assert(maximumCount > 0)
|
||||
assert(maxCount > 0)
|
||||
guard self.advanceToUnoccupied() else { return nil }
|
||||
assert(!self.isOccupied)
|
||||
let start = self.currentBucket
|
||||
self.advanceToOccupied(maximumCount: maximumCount)
|
||||
self.advanceToOccupied(maxCount: maxCount)
|
||||
let end = self.currentBucket
|
||||
return Range(uncheckedBounds: (start, end))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user