Skip to content

Commit 01838db

Browse files
author
Abduqodiri Qurbonzoda
committed
Allow hashMap collisions to be located at any level
1 parent a85d6aa commit 01838db

File tree

3 files changed

+157
-78
lines changed

3 files changed

+157
-78
lines changed

core/commonMain/src/implementations/immutableMap/PersistentHashMapBuilderContentIterators.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ internal abstract class PersistentHashMapBuilderBaseIterator<K, V, T>(private va
7979

8080
val nodeIndex = node.nodeIndex(keyPositionMask)
8181
val targetNode = node.nodeAtIndex(nodeIndex)
82-
if (shift == MAX_SHIFT) { // collision
82+
if (targetNode.isCollision()) {
8383
path[pathIndex].reset(node.buffer, node.buffer.size, 0)
8484
while (path[pathIndex].currentKey() != key) {
8585
path[pathIndex].moveToNextKey()

core/commonMain/src/implementations/immutableMap/PersistentHashMapContentIterators.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ internal abstract class PersistentHashMapBaseIterator<K, V, T>(node: TrieNode<K,
116116
}
117117
if (path[pathIndex].hasNextNode()) {
118118
val node = path[pathIndex].currentNode()
119-
if (pathIndex == TRIE_MAX_HEIGHT - 1) { // collision
119+
if (node.isCollision()) {
120120
path[pathIndex + 1].reset(node.buffer, node.buffer.size)
121121
} else {
122122
path[pathIndex + 1].reset(node.buffer, ENTRY_SIZE * node.entryCount())

0 commit comments

Comments
 (0)