Minheap
struct minheap_node { struct spinlock lock; uint64_t key; uint32_t index;};struct minheap_node referenced types:
struct minheap { struct minheap_node **nodes; uint32_t capacity; uint32_t size;};struct minheap referenced types:
struct minheap_node minheap_peek(struct minheap *heap);minheap_peek referenced types:
bool minheap_node_valid(struct minheap_node *node);minheap_node_valid referenced types:
Defines
Section titled “Defines”#define MINHEAP_INIT_CAP 32#define MINHEAP_INDEX_INVALID ((uint32_t) -1)#define minheap_for_each(heap, node_ptr) \ for (uint32_t __i = 0; \ (node_ptr = ((heap)->nodes[__i]), __i < (heap)->size); __i++)#define MINHEAP_SIZE(mh) (atomic_load(&mh->size))#define MINHEAP_CAPACITY(mh) (atomic_load(&mh->capacity))#define MINHEAP_NODE_KEY(mhn) (atomic_load(&mhn->key))#define MINHEAP_NODE_INDEX(mhn) (atomic_load(&mhn->index))#define MINHEAP_SET_SIZE(mh, n) (atomic_store(&mh->size, n))#define MINHEAP_SET_CAPACITY(mh, n) (atomic_store(&mh->capacity, n))#define MINHEAP_NODE_SET_KEY(mhn, n) (atomic_store(&mhn->key, n))#define MINHEAP_NODE_SET_INDEX(mhn, n) (atomic_store(&mhn->index, n))#define MINHEAP_NODE_INVALID(mhn) \ (MINHEAP_NODE_INDEX(mhn) == MINHEAP_INDEX_INVALID)#define MINHEAP_MARK_NODE_INVALID(mhn) \ (MINHEAP_NODE_SET_INDEX(mhn, MINHEAP_INDEX_INVALID))