[bit-page] Write hash() as dagger

This commit is contained in:
Behdad Esfahbod 2022-11-18 16:02:45 -07:00
parent 87271e1b2e
commit 68a29020c5
1 changed files with 5 additions and 5 deletions

View File

@ -94,10 +94,10 @@ struct hb_bit_page_t
} }
uint32_t hash () const uint32_t hash () const
{ {
uint32_t h = 0; return
for (unsigned i = 0; i < len (); i++) + hb_iter (v)
h = h * 31 + hb_hash (v[i]); | hb_reduce ([] (uint32_t h, const elt_t &_) { return h * 31 + hb_hash (_); }, (uint32_t) 0u)
return h; ;
} }
void add (hb_codepoint_t g) { elt (g) |= mask (g); } void add (hb_codepoint_t g) { elt (g) |= mask (g); }
@ -222,7 +222,7 @@ struct hb_bit_page_t
{ {
return return
+ hb_iter (v) + 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)
; ;
} }