( edit: number, shift: number, h1: number, n1: Node<K, V>, h2: number, n2: Node<K, V> )
| 343 | } |
| 344 | |
| 345 | function mergeLeavesInner<K, V>( |
| 346 | edit: number, |
| 347 | shift: number, |
| 348 | h1: number, |
| 349 | n1: Node<K, V>, |
| 350 | h2: number, |
| 351 | n2: Node<K, V> |
| 352 | ): Node<K, V> | ((child: Node<K, V>) => Node<K, V>) { |
| 353 | if (h1 === h2) return new CollisionNode(edit, h1, [n2, n1]) |
| 354 | const subH1 = hashFragment(shift, h1) |
| 355 | const subH2 = hashFragment(shift, h2) |
| 356 | |
| 357 | if (subH1 === subH2) { |
| 358 | return (child) => new IndexedNode(edit, toBitmap(subH1) | toBitmap(subH2), [child]) |
| 359 | } else { |
| 360 | const children = subH1 < subH2 ? [n1, n2] : [n2, n1] |
| 361 | return new IndexedNode(edit, toBitmap(subH1) | toBitmap(subH2), children) |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | function mergeLeaves<K, V>( |
| 366 | edit: number, |
no test coverage detected
searching dependent graphs…