From 68a29020c586a17bcefead7041cf64033a0c3cea Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 18 Nov 2022 16:02:45 -0700 Subject: [PATCH] [bit-page] Write hash() as dagger --- src/hb-bit-page.hh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hb-bit-page.hh b/src/hb-bit-page.hh index e1635af2a..8d910832f 100644 --- a/src/hb-bit-page.hh +++ b/src/hb-bit-page.hh @@ -94,10 +94,10 @@ struct hb_bit_page_t } uint32_t hash () const { - uint32_t h = 0; - for (unsigned i = 0; i < len (); i++) - h = h * 31 + hb_hash (v[i]); - return h; + return + + hb_iter (v) + | hb_reduce ([] (uint32_t h, const elt_t &_) { return h * 31 + hb_hash (_); }, (uint32_t) 0u) + ; } void add (hb_codepoint_t g) { elt (g) |= mask (g); } @@ -222,7 +222,7 @@ struct hb_bit_page_t { return + hb_iter (v) - | hb_reduce ([] (unsigned pop, const elt_t &_) { return pop + hb_popcount (_); }, 0) + | hb_reduce ([] (unsigned pop, const elt_t &_) { return pop + hb_popcount (_); }, 0u) ; }