From 749dc1eee0f7412b5d3893a33fead4420a58c084 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 4 Feb 2025 22:53:17 +0000 Subject: [PATCH] [bit-set] Fix may_intersect() logic --- src/hb-bit-set.hh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/hb-bit-set.hh b/src/hb-bit-set.hh index c303e2bef..80000149f 100644 --- a/src/hb-bit-set.hh +++ b/src/hb-bit-set.hh @@ -366,11 +366,14 @@ struct hb_bit_set_t unsigned int a = 0, b = 0; for (; a < na && b < nb; ) { - if (page_map.arrayZ[a].major == other.page_map.arrayZ[b].major && - page_at (a).may_intersect (other.page_at (b))) - return true; - - if (page_map.arrayZ[a].major < other.page_map.arrayZ[b].major) + if (page_map.arrayZ[a].major == other.page_map.arrayZ[b].major) + { + if (likely (page_at (a).may_intersect (other.page_at (b)))) + return true; + a++; + b++; + } + else if (page_map.arrayZ[a].major < other.page_map.arrayZ[b].major) a++; else b++;