From e7879d6c554d1edaf02a211d6ba9de4fe2b3fbf4 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 10 Nov 2023 14:13:20 -0700 Subject: [PATCH] [map] Micro-optimize destruction --- src/hb-map.hh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hb-map.hh b/src/hb-map.hh index a692b21e4..275dcbe93 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh @@ -211,9 +211,10 @@ struct hb_hashmap_t old_items[i].hash, std::move (old_items[i].value)); } - if (!item_t::is_trivial) - old_items[i].~item_t (); } + if (!item_t::is_trivial) + for (unsigned int i = 0; i < old_size; i++) + old_items[i].~item_t (); hb_free (old_items);