From da38312e4201185621b440faf8faf57084a38e7f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 20 May 2022 17:32:56 -0600 Subject: [PATCH] [VarStore] Pepper cache with likely() --- src/hb-ot-layout-common.hh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 61d0cf14f..203822d7c 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -2618,7 +2618,7 @@ struct VarRegionList if (cache) { cached = &(cache[region_index]); - if (*cached != REGION_CACHE_ITEM_CACHE_INVALID) + if (likely (*cached != REGION_CACHE_ITEM_CACHE_INVALID)) return *cached; } @@ -2632,14 +2632,14 @@ struct VarRegionList float factor = axes[i].evaluate (coord); if (factor == 0.f) { - if (cached) + if (cache) *cached = 0.; return 0.; } v *= factor; } - if (cached) + if (cache) *cached = v; return v; } @@ -2877,11 +2877,9 @@ struct VariationStore float *cache = (float *) hb_malloc (sizeof (float) * count); if (unlikely (!cache)) return nullptr; - for (unsigned i = 0; i < count; i++) cache[i] = REGION_CACHE_ITEM_CACHE_INVALID; - return cache; }