From f6803b06bf7ef6b6a480e9dd489a8fa693d7b403 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 25 Apr 2023 14:46:44 -0600 Subject: [PATCH] [VarRegionAxis] Micro-optimize peak==0 is common. --- src/hb-ot-layout-common.hh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 619e7c4b8..52b7dc254 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -2272,7 +2272,11 @@ struct VarRegionAxis { float evaluate (int coord) const { - int start = startCoord.to_int (), peak = peakCoord.to_int (), end = endCoord.to_int (); + int peak = peakCoord.to_int (); + if (peak == 0 || coord == peak) + return 1.f; + + int start = startCoord.to_int (), end = endCoord.to_int (); /* TODO Move these to sanitize(). */ if (unlikely (start > peak || peak > end)) @@ -2280,9 +2284,6 @@ struct VarRegionAxis if (unlikely (start < 0 && end > 0 && peak != 0)) return 1.f; - if (peak == 0 || coord == peak) - return 1.f; - if (coord <= start || end <= coord) return 0.f;