Skip to content

Minheap

include/structures/minheap.h View source View on GitHub
struct minheap_node (2 fields) source
struct minheap (4 fields) source
§ struct minheap_node **nodes
§ atomic_uint32_t capacity
§ struct spinlock lock
void minheap_insert(
    struct minheap *heap,
    struct minheap_node *node,
    uint64_t key
)
source
void minheap_remove(struct minheap *heap, struct minheap_node *node)
source
void minheap_expand(struct minheap *heap, uint32_t new_size)
source
struct minheap_node * minheap_peek(struct minheap *heap)
source
struct minheap_node * minheap_pop(struct minheap *heap)
source
bool minheap_node_valid(struct minheap_node *node)
source
struct minheap *cc_nullable
source
#define MINHEAP_INIT_CAP 32
source
#define MINHEAP_INDEX_INVALID ((uint32_t) -1)
source
#define minheap_for_each(node_ptr_, heap_)
source
Expansion
#define minheap_for_each(node_ptr_, heap_) \
    for (uint32_t __mh_idx = 0; \
         __mh_idx < (heap_)->size && \
         (((node_ptr_) = ((heap_)->nodes[__mh_idx])), true); \
         __mh_idx++)
#define MINHEAP_SIZE(mh)
source
Expansion
#define MINHEAP_SIZE(mh) (atomic_load(&mh->size))
#define MINHEAP_CAPACITY(mh)
source
Expansion
#define MINHEAP_CAPACITY(mh) (atomic_load(&mh->capacity))
#define MINHEAP_NODE_KEY(mhn)
source
Expansion
#define MINHEAP_NODE_KEY(mhn) (atomic_load(&mhn->key))
#define MINHEAP_NODE_INDEX(mhn)
source
Expansion
#define MINHEAP_NODE_INDEX(mhn) (atomic_load(&mhn->index))
#define MINHEAP_SET_SIZE(mh, n)
source
Expansion
#define MINHEAP_SET_SIZE(mh, n) (atomic_store(&mh->size, n))
#define MINHEAP_SET_CAPACITY(mh, n)
source
Expansion
#define MINHEAP_SET_CAPACITY(mh, n) (atomic_store(&mh->capacity, n))
#define MINHEAP_NODE_SET_KEY(mhn, n)
source
Expansion
#define MINHEAP_NODE_SET_KEY(mhn, n) (atomic_store(&mhn->key, n))
#define MINHEAP_NODE_SET_INDEX(mhn, n)
source
Expansion
#define MINHEAP_NODE_SET_INDEX(mhn, n) (atomic_store(&mhn->index, n))
#define MINHEAP_NODE_INVALID(mhn)
source
#define MINHEAP_MARK_NODE_INVALID(mhn)
source