MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / right_sibling

Method right_sibling

cranelift/bforest/src/path.rs:611–632  ·  view source on GitHub ↗

Get the right sibling node to the current node at `level`. Also return the critical key between the current node and the right sibling.

(&self, level: usize, pool: &NodePool<F>)

Source from the content-addressed store, hash-verified

609 /// Get the right sibling node to the current node at `level`.
610 /// Also return the critical key between the current node and the right sibling.
611 fn right_sibling(&self, level: usize, pool: &NodePool<F>) -> Option<(F::Key, Node)> {
612 // Find the critical level: The deepest level where two sibling subtrees contain the
613 // current node and its right sibling.
614 self.right_sibling_branch_level(level, pool).map(|bl| {
615 // Extract the critical key and the `bl+1` node.
616 let be = usize::from(self.entry[bl]);
617 let crit_key;
618 let mut node;
619 {
620 let (keys, tree) = pool[self.node[bl]].unwrap_inner();
621 crit_key = keys[be];
622 node = tree[be + 1];
623 }
624
625 // Follow left-most links back down to `level`.
626 for _ in bl + 1..level {
627 node = pool[node].unwrap_inner().1[0];
628 }
629
630 (crit_key, node)
631 })
632 }
633
634 /// Update the critical key for the right sibling node at `level`.
635 fn update_right_crit_key(&self, level: usize, crit_key: F::Key, pool: &mut NodePool<F>) {

Callers 2

underflowed_nodeMethod · 0.80
empty_nodeMethod · 0.80

Calls 4

fromFunction · 0.85
unwrap_innerMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected