mirror of
https://github.com/apple/swift-collections
synced 2026-11-26 04:47:48 +00:00
[PersistentCollections] Convert global lets to computed properties
This is just to prevent these from getting turned into global variables that are initialized on first access, especially once we make things inlinable. (I expect these will all get moved under some type eventually.)
This commit is contained in:
1 parent
8d96e3d847
commit
7d6d779377
1 file changed
+10
-4
@@ -13,13 +13,19 @@ internal func _computeHash<T: Hashable>(_ value: T) -> Int {
|
||||
value.hashValue
|
||||
}
|
||||
|
||||
internal let _bitPartitionSize: Int = 5
|
||||
@inline(__always)
|
||||
internal var _bitPartitionSize: Int { 5 }
|
||||
|
||||
internal let _bitPartitionMask: Int = (1 << _bitPartitionSize) - 1
|
||||
@inline(__always)
|
||||
internal var _bitPartitionMask: Int { (1 << _bitPartitionSize) - 1 }
|
||||
|
||||
internal let _hashCodeLength: Int = Int.bitWidth
|
||||
@inline(__always)
|
||||
internal var _hashCodeLength: Int { Int.bitWidth }
|
||||
|
||||
internal let _maxDepth = (_hashCodeLength + _bitPartitionSize - 1) / _bitPartitionSize
|
||||
@inline(__always)
|
||||
internal var _maxDepth: Int {
|
||||
(_hashCodeLength + _bitPartitionSize - 1) / _bitPartitionSize
|
||||
}
|
||||
|
||||
internal func _maskFrom(_ hash: Int, _ shift: Int) -> Int {
|
||||
(hash >> shift) & _bitPartitionMask
|
||||
|
||||
Reference in new issue
Block a user