From 2a42edccbe55ede9ed7bbf643b7bec41698078ed Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 4 May 2022 17:06:18 -0600 Subject: [PATCH] [subset] Cosmetic; use set bulk array population instead of for loop --- src/hb-subset-plan.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index 6b71e1697..630c08b6b 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -344,12 +344,11 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes, } } - for (unsigned i = 0; i < plan->unicode_to_new_gid_list.length; i++) + auto &arr = plan->unicode_to_new_gid_list; + if (arr.length) { - // Use raw array access for performance. - hb_pair_t pair = plan->unicode_to_new_gid_list.arrayZ[i]; - plan->unicodes->add(pair.first); - plan->_glyphset_gsub->add(pair.second); + plan->unicodes->add_sorted_array (&arr.arrayZ->first, arr.length, sizeof (*arr.arrayZ)); + plan->_glyphset_gsub->add_array (&arr.arrayZ->second, arr.length, sizeof (*arr.arrayZ)); } }