/* Get the first prio_tree_node that overlaps with the interval . Note that always radix_index <= heap_index. We do a pre-order traversal of the tree.  */
static struct prio_tree_node* prio_tree_first(struct prio_tree_iter *iter)
/* Get the first prio_tree_node that overlaps with the interval . Note that always radix_index <= heap_index. We do a pre-order traversal of the tree.  */
static struct prio_tree_node* prio_tree_first(struct prio_tree_iter *iter)
{
	struct prio_tree_root *root;
	unsigned long r_index, h_index;
	INIT_PRIO_TREE_ITER(iter);
	root = iter->root;
	if (prio_tree_empty(root))
		return NULL;
	get_index(root, root->prio_tree_node, &r_index, &h_index);
	if (iter->r_index > h_index)
		return NULL;
	iter->mask = 1UL << (root->index_bits - 1);
	iter->cur = root->prio_tree_node;
	while (1) {
		if (overlap(iter, r_index, h_index))
			return iter->cur;
		if (prio_tree_left(iter, &r_index, &h_index))
			continue;
		if (prio_tree_right(iter, &r_index, &h_index))
			continue;
		break;
	}
	return NULL;
}