Home | History | Annotate | Download | only in lib

Lines Matching refs:root

75 static struct prio_tree_node *prio_tree_expand(struct prio_tree_root *root,
80 if (max_heap_index > prio_tree_maxindex(root->index_bits))
81 root->index_bits++;
83 while (max_heap_index > prio_tree_maxindex(root->index_bits)) {
84 root->index_bits++;
86 if (prio_tree_empty(root))
90 first = root->prio_tree_node;
91 prio_tree_remove(root, root->prio_tree_node);
96 last = root->prio_tree_node;
97 prio_tree_remove(root, root->prio_tree_node);
112 if (!prio_tree_empty(root)) {
113 last->left = root->prio_tree_node;
117 root->prio_tree_node = node;
124 struct prio_tree_node *prio_tree_replace(struct prio_tree_root *root,
130 assert(root->prio_tree_node == old);
132 * We can reduce root->index_bits here. However, it is complex
136 root->prio_tree_node = node;
159 * Insert a prio_tree_node @node into a radix priority search tree @root. The
168 struct prio_tree_node *prio_tree_insert(struct prio_tree_root *root,
178 if (prio_tree_empty(root) ||
179 heap_index > prio_tree_maxindex(root->index_bits))
180 return prio_tree_expand(root, node, heap_index);
182 cur = root->prio_tree_node;
183 mask = 1UL << (root->index_bits - 1);
194 node = prio_tree_replace(root, cur, node);
241 * Remove a prio_tree_node @node from a radix priority search tree @root. The
245 void prio_tree_remove(struct prio_tree_root *root, struct prio_tree_node *node)
275 assert(root->prio_tree_node == cur);
276 INIT_PRIO_TREE_ROOT(root);
286 cur = prio_tree_replace(root, cur->parent, cur);
401 struct prio_tree_root *root;
406 root = iter->root;
407 if (prio_tree_empty(root))
410 get_index(root->prio_tree_node, &r_index, &h_index);
415 iter->mask = 1UL << (root->index_bits - 1);
416 iter->cur = root->prio_tree_node;