15 #ifndef included_clib_fheap_h 16 #define included_clib_fheap_h 47 #define foreach_fheap_node_sibling(f,ni,first_ni,body) \ 49 u32 __fheap_foreach_first_ni = (first_ni); \ 50 u32 __fheap_foreach_ni = __fheap_foreach_first_ni; \ 51 u32 __fheap_foreach_next_ni; \ 52 fheap_node_t * __fheap_foreach_n; \ 53 if (__fheap_foreach_ni != ~0) \ 56 __fheap_foreach_n = fheap_get_node ((f), __fheap_foreach_ni); \ 57 __fheap_foreach_next_ni = __fheap_foreach_n -> next_sibling; \ 58 (ni) = __fheap_foreach_ni; \ 63 if (__fheap_foreach_next_ni == __fheap_foreach_first_ni) \ 66 __fheap_foreach_ni = __fheap_foreach_next_ni; \ 92 memset (f, 0,
sizeof (f[0]));
94 f->
nodes = save_nodes;
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static u32 fheap_find_min(fheap_t *f)
void fheap_del(fheap_t *f, u32 ni)
static u32 fheap_is_empty(fheap_t *f)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
memset(h->entries, 0, sizeof(h->entries[0])*entries)
static void fheap_init(fheap_t *f, u32 n_nodes)
void fheap_decrease_key(fheap_t *f, u32 ni, u32 new_key)
#define vec_free(V)
Free vector's memory (no header).
static void fheap_free(fheap_t *f)
u32 fheap_del_min(fheap_t *f, u32 *min_key)
void fheap_add(fheap_t *f, u32 ni, u32 key)
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".