From 9308659fd76bb400da2c869ca2f945760adfaf56 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 18 May 2022 16:14:25 -0600 Subject: [PATCH] [priority-queue] Optimize swap() --- src/hb-priority-queue.hh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hb-priority-queue.hh b/src/hb-priority-queue.hh index 7d799ae90..9c02eb423 100644 --- a/src/hb-priority-queue.hh +++ b/src/hb-priority-queue.hh @@ -142,9 +142,9 @@ struct hb_priority_queue_t void swap (unsigned a, unsigned b) { - item_t temp = heap[a]; - heap[a] = heap[b]; - heap[b] = temp; + assert (a <= heap.length); + assert (b <= heap.length); + hb_swap (heap.arrayZ[a], heap.arrayZ[b]); } };