[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:
Karoy Lorentey committed 2022-09-09 00:47:10 -07:00
1 parent 8d96e3d847
commit 7d6d779377
1 file changed
+10 -4
+10 -4
View File
@@ -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