From 1bd386515c603a1e77291f77e50dc7cb3437dbcd Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 4 Dec 2022 12:29:23 -0700 Subject: [PATCH] [bit-set] Micro-optimize page_for --- src/hb-bit-set.hh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hb-bit-set.hh b/src/hb-bit-set.hh index 76bc524e9..8de6e037f 100644 --- a/src/hb-bit-set.hh +++ b/src/hb-bit-set.hh @@ -901,7 +901,7 @@ struct hb_bit_set_t { auto &cached_page = page_map.arrayZ[i]; if (cached_page.major == major) - return &pages[cached_page.index]; + return &pages.arrayZ[cached_page.index]; } page_map_t map = {major, pages.length}; @@ -913,15 +913,15 @@ struct hb_bit_set_t if (unlikely (!resize (pages.length + 1))) return nullptr; - pages[map.index].init0 (); - memmove (page_map + i + 1, - page_map + i, + pages.arrayZ[map.index].init0 (); + memmove (page_map.arrayZ + i + 1, + page_map.arrayZ + i, (page_map.length - 1 - i) * page_map.item_size); page_map[i] = map; } last_page_lookup = i; - return &pages[page_map[i].index]; + return &pages.arrayZ[page_map.arrayZ[i].index]; } const page_t *page_for (hb_codepoint_t g) const {