mirror of
https://github.com/apple/swift-collections
synced 2026-11-28 05:04:21 +00:00
[BasicContainers] Make _HTable nonfrozen and most of its operations noninlinable
This is a nongeneric type, so it makes sense to see if Swift has matured enough to use opaque/resilient types in high-performance contexts. It would be ideal if the core hash table implementation would remain flexible. We may need to sprinkle some effect attributes over these.
This commit is contained in:
7 files changed
+40
-64
No files matched your search
@@ -191,15 +191,13 @@ extension _HTable {
|
||||
|
||||
extension _HTable {
|
||||
@_transparent
|
||||
@inlinable
|
||||
package func idealBucket(forHashValue hashValue: Int) -> Bucket {
|
||||
internal func idealBucket(forHashValue hashValue: Int) -> Bucket {
|
||||
let hashValue = UInt(truncatingIfNeeded: hashValue)
|
||||
return Bucket(offset: hashValue & (bucketCount &- 1))
|
||||
}
|
||||
|
||||
@_transparent
|
||||
@inlinable
|
||||
package func probeLength(
|
||||
internal func probeLength(
|
||||
from start: Bucket,
|
||||
to end: Bucket
|
||||
) -> Int {
|
||||
@@ -210,8 +208,7 @@ extension _HTable {
|
||||
}
|
||||
|
||||
@_transparent
|
||||
@inlinable
|
||||
package func probeLength(
|
||||
internal func probeLength(
|
||||
forHashValue hashValue: Int,
|
||||
in bucket: Bucket
|
||||
) -> Int {
|
||||
@@ -221,11 +218,12 @@ extension _HTable {
|
||||
}
|
||||
|
||||
extension _HTable {
|
||||
@inlinable
|
||||
@usableFromInline
|
||||
package mutating func clear() {
|
||||
self._count = 0
|
||||
self.bitmap.clearAll()
|
||||
self._totalProbeLength = 0
|
||||
self._maxProbeLength = 0
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in new issue
Block a user