43 #define pairingheap_container(type, membername, ptr) \
44 (AssertVariableIsOfTypeMacro(ptr, pairingheap_node *), \
45 AssertVariableIsOfTypeMacro(((type *) NULL)->membername, pairingheap_node), \
46 ((type *) ((char *) (ptr) - offsetof(type, membername))))
51 #define pairingheap_const_container(type, membername, ptr) \
52 (AssertVariableIsOfTypeMacro(ptr, const pairingheap_node *), \
53 AssertVariableIsOfTypeMacro(((type *) NULL)->membername, pairingheap_node), \
54 ((const type *) ((const char *) (ptr) - offsetof(type, membername))))
86 #ifdef PAIRINGHEAP_DEBUG
93 #define pairingheap_reset(h) ((h)->ph_root = NULL)
96 #define pairingheap_is_empty(h) ((h)->ph_root == NULL)
99 #define pairingheap_is_singular(h) \
100 ((h)->ph_root && (h)->ph_root->first_child == NULL)
static int compare(const void *arg1, const void *arg2)
void pairingheap_remove(pairingheap *heap, pairingheap_node *node)
void pairingheap_add(pairingheap *heap, pairingheap_node *node)
pairingheap_node * pairingheap_first(pairingheap *heap)
pairingheap * pairingheap_allocate(pairingheap_comparator compare, void *arg)
struct pairingheap pairingheap
int(* pairingheap_comparator)(const pairingheap_node *a, const pairingheap_node *b, void *arg)
void pairingheap_free(pairingheap *heap)
struct pairingheap_node pairingheap_node
pairingheap_node * pairingheap_remove_first(pairingheap *heap)
struct pairingheap_node * next_sibling
struct pairingheap_node * prev_or_parent
struct pairingheap_node * first_child
pairingheap_comparator ph_compare
pairingheap_node * ph_root