[map] Rewrite hash() as dagger

Somehow our daggers instead of for loop save size. I cannot
pinpoint why, other than maybe not inlining.
This commit is contained in:
Behdad Esfahbod 2022-11-18 16:39:30 -07:00
parent 025a68cb07
commit 4ec706980c
1 changed files with 4 additions and 4 deletions

View File

@ -250,10 +250,10 @@ struct hb_hashmap_t
uint32_t hash () const
{
uint32_t h = 0;
for (auto item : iter_items ())
h ^= item.total_hash ();
return h;
return
+ iter_items ()
| hb_reduce ([] (uint32_t h, const item_t &_) { return h ^ _.total_hash (); }, (uint32_t) 0u)
;
}
bool is_equal (const hb_hashmap_t &other) const