aboutsummaryrefslogtreecommitdiff
path: root/src/hb-priority-queue.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/hb-priority-queue.hh')
-rw-r--r--src/hb-priority-queue.hh9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/hb-priority-queue.hh b/src/hb-priority-queue.hh
index 938c02872..2c8ccbfb6 100644
--- a/src/hb-priority-queue.hh
+++ b/src/hb-priority-queue.hh
@@ -42,10 +42,11 @@
* priority of its children. The heap is stored in an array, with the
* children of node i stored at indices 2i + 1 and 2i + 2.
*/
+template <typename K>
struct hb_priority_queue_t
{
private:
- typedef hb_pair_t<int64_t, unsigned> item_t;
+ typedef hb_pair_t<K, unsigned> item_t;
hb_vector_t<item_t> heap;
public:
@@ -54,7 +55,10 @@ struct hb_priority_queue_t
bool in_error () const { return heap.in_error (); }
- void insert (int64_t priority, unsigned value)
+#ifndef HB_OPTIMIZE_SIZE
+ HB_ALWAYS_INLINE
+#endif
+ void insert (K priority, unsigned value)
{
heap.push (item_t (priority, value));
if (unlikely (heap.in_error ())) return;
@@ -139,6 +143,7 @@ struct hb_priority_queue_t
goto repeat;
}
+ HB_ALWAYS_INLINE
void bubble_up (unsigned index)
{
repeat: