Skip to content

Commit

Permalink
[PersistentCollections] Introduce _Bucket, _Bitmap, _HashPath, and _H…
Browse files Browse the repository at this point in the history
…ashValue

These provide nicer tools for slicing up hash values and dealing with node bitmaps.

_Bucket is a logical entry in the hash table inside a node.
_Bitmap is a set of bucket values, represented by a bitset.
_HashPath facilitates slicing up a hash value into a series of bucket values.
_HashValue represents a hash value.

This is still just mostly superficial refactoring, with little to no functional changes.
  • Loading branch information
lorentey committed Sep 9, 2022
1 parent 8429144 commit 14f9062
Show file tree
Hide file tree
Showing 16 changed files with 712 additions and 557 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ extension PersistentDictionary: Collection {

/// Returns the index for the given key.
public func index(forKey key: Key) -> Index? {
rootNode.index(key, _computeHash(key), 0, 0)
rootNode.index(forKey: key, _HashPath(key), 0)
}

/// Accesses the key-value pair at the specified position.
public subscript(position: Index) -> Element {
rootNode.get(position: position, 0, position._value)
rootNode.item(position: position._value)
}
}

Loading

0 comments on commit 14f9062

Please sign in to comment.