/* A heap node, to be embedded inside the data structure in the heap. */
struct heap_node {
size_t idx;
- uint32_t priority;
+ uint64_t priority;
};
/* A max-heap. */
static inline bool heap_is_empty(const struct heap *);
/* Insertion and deletion. */
-void heap_insert(struct heap *, struct heap_node *, uint32_t priority);
-void heap_change(struct heap *, struct heap_node *, uint32_t priority);
+void heap_insert(struct heap *, struct heap_node *, uint64_t priority);
+void heap_change(struct heap *, struct heap_node *, uint64_t priority);
void heap_remove(struct heap *, struct heap_node *);
static inline struct heap_node *heap_pop(struct heap *);
/* The "raw" functions below do not preserve the heap invariants. After you
* call them, heap_max() will not necessarily return the right value until you
* subsequently call heap_rebuild(). */
-void heap_raw_insert(struct heap *, struct heap_node *, uint32_t priority);
-static inline void heap_raw_change(struct heap_node *, uint32_t priority);
+void heap_raw_insert(struct heap *, struct heap_node *, uint64_t priority);
+static inline void heap_raw_change(struct heap_node *, uint64_t priority);
void heap_raw_remove(struct heap *, struct heap_node *);
void heap_rebuild(struct heap *);
*
* This takes time O(1). */
static inline void
-heap_raw_change(struct heap_node *node, uint32_t priority)
+heap_raw_change(struct heap_node *node, uint64_t priority)
{
node->priority = priority;
}