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