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

Method goto_subtree_last

cranelift/bforest/src/path.rs:205–223  ·  view source on GitHub ↗

Move this path to the last position for the sub-tree at `level, root`.

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

Source from the content-addressed store, hash-verified

203
204 /// Move this path to the last position for the sub-tree at `level, root`.
205 fn goto_subtree_last(&mut self, level: usize, root: Node, pool: &NodePool<F>) -> Node {
206 let mut node = root;
207 for l in level.. {
208 self.node[l] = node;
209 match pool[node] {
210 NodeData::Inner { size, ref tree, .. } => {
211 self.entry[l] = size;
212 node = tree[usize::from(size)];
213 }
214 NodeData::Leaf { size, .. } => {
215 self.entry[l] = size - 1;
216 self.size = l + 1;
217 break;
218 }
219 NodeData::Free { .. } => panic!("Free {node} reached from {root}"),
220 }
221 }
222 node
223 }
224
225 /// Set the root node and point the path at the first entry of the node.
226 pub fn set_root_node(&mut self, root: Node) {

Callers 2

prevMethod · 0.80
prev_leafMethod · 0.80

Calls 1

fromFunction · 0.85

Tested by

no test coverage detected