[array] Rewrite hash() as dagger

This commit is contained in:
Behdad Esfahbod 2022-11-18 17:26:58 -07:00
parent 213117317c
commit 921f45f46d
1 changed files with 6 additions and 6 deletions

View File

@ -112,12 +112,12 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
HB_INTERNAL bool operator == (const hb_array_t &o) const;
uint32_t hash () const {
uint32_t current = 0;
for (unsigned int i = 0; i < this->length; i++) {
current = current * 31 + hb_hash (this->arrayZ[i]);
}
return current;
uint32_t hash () const
{
return
+ hb_iter (*this)
| hb_reduce ([] (uint32_t h, const Type &_) { return h * 31 + hb_hash (_); }, (uint32_t) 0u)
;
}
/*