From dabbf13d402620e605ad497b58dbfb61aed28a3d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 3 Dec 2022 09:46:11 -0700 Subject: [PATCH] [cmap] Speed up DefaultUVS::copy --- src/hb-ot-cmap-table.hh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 82d5e8602..bca60e6d3 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -930,10 +930,11 @@ struct DefaultUVS : SortedArray32Of for (const UnicodeValueRange& _ : as_array ()) { - for (const unsigned addcnt : hb_range ((unsigned) _.additionalCount + 1)) + unsigned curEntry = (unsigned) _.startUnicodeValue - 1; + unsigned end = curEntry + _.additionalCount + 2; + + for (; unicodes->next (&curEntry) && curEntry < end;) { - unsigned curEntry = (unsigned) _.startUnicodeValue + addcnt; - if (!unicodes->has (curEntry)) continue; count += 1; if (lastCode == HB_MAP_VALUE_INVALID) lastCode = curEntry;