65 }
while (si != si_start);
73 m = vec_elt_at_index (f->nodes, si);
76 ASSERT (m->parent == n->parent);
92 m = vec_elt_at_index (f->nodes, si);
95 ASSERT (m->key >= n->key);
97 if (! found_first_child)
98 found_first_child = si == n->first_child;
104 ASSERT (found_first_child);
154 memset (n, 0,
sizeof (n[0]));
184 u32 list_has_single_element = prev_ni == ni;
193 p->
first_child = list_has_single_element ? ~0 : next_ni;
211 return list_has_single_element ? ~0 : next_ni;
224 u32 ri, lo_i, hi_i, k;
248 lo =
hi, lo_i = hi_i;
312 u32 ri_last, ri_next,
i, min_ds;
353 return to_delete_min_ri;
426 fheap_node_remove (f, ci);
427 fheap_node_add_sibling (f, f->min_root, ci);
#define vec_foreach_index(var, v)
Iterate over vector indices.
sll srl srl sll sra u16x4 i
always_inline u32 fheap_node_remove(fheap_t *f, u32 ni)
void fheap_add(fheap_t *f, u32 ni, u32 key)
always_inline void fheap_node_add_sibling(fheap_t *f, u32 ni, u32 ni_to_add)
always_inline fheap_node_t * fheap_get_node(fheap_t *f, u32 i)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
always_inline u32 fheap_node_remove_internal(fheap_t *f, u32 ni, u32 invalidate)
always_inline fheap_node_t * fheap_get_root(fheap_t *f)
static void fheap_link_root(fheap_t *f, u32 ni)
#define foreach_fheap_node_sibling(f, ni, first_ni, body)
always_inline u32 fheap_node_remove_and_invalidate(fheap_t *f, u32 ni)
static void fheap_mark_parent(fheap_t *f, u32 pi)
void fheap_del(fheap_t *f, u32 ni)
void fheap_decrease_key(fheap_t *f, u32 ni, u32 new_key)
u32 fheap_del_min(fheap_t *f, u32 *min_key)
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
static void fheap_validate(fheap_t *f)