From a4cd11dea9a97e16fffff72312ee1ae7198d59fb Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 6 Feb 2025 01:10:40 +0000 Subject: [PATCH] [bit-page] Micro-optimize --- src/hb-bit-page.hh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/hb-bit-page.hh b/src/hb-bit-page.hh index a0e1d6ac0..4b9374870 100644 --- a/src/hb-bit-page.hh +++ b/src/hb-bit-page.hh @@ -103,10 +103,10 @@ struct hb_bit_page_t bool is_empty () const { if (has_population ()) return !population; - return - + hb_iter (v) - | hb_none - ; + for (unsigned i = 0; i < len (); i++) + if (v[i]) + return false; + return true; } uint32_t hash () const { @@ -260,10 +260,9 @@ struct hb_bit_page_t unsigned int get_population () const { if (has_population ()) return population; - population = - + hb_iter (v) - | hb_reduce ([] (unsigned pop, const elt_t &_) { return pop + hb_popcount (_); }, 0u) - ; + population = 0; + for (unsigned i = 0; i < len (); i++) + population += hb_popcount (v[i]); return population; }