diff --git a/src/hb-bit-page.hh b/src/hb-bit-page.hh index 3fb188d4e..a7c788b16 100644 --- a/src/hb-bit-page.hh +++ b/src/hb-bit-page.hh @@ -49,7 +49,7 @@ struct hb_bit_page_t { unsigned h = 0; for (unsigned int i = 0; i < len (); i++) - h ^= hb_hash (v[i] ^ i); + h = h * 31 + hb_hash (v[i]); return h; } diff --git a/src/hb-bit-set.hh b/src/hb-bit-set.hh index dddaf66ab..d4a227352 100644 --- a/src/hb-bit-set.hh +++ b/src/hb-bit-set.hh @@ -71,7 +71,6 @@ struct hb_bit_set_t { int cmp (const page_map_t &o) const { return cmp (o.major); } int cmp (uint32_t o_major) const { return (int) o_major - (int) major; } - unsigned hash () const { return major ^ index; } uint32_t major; uint32_t index; @@ -129,7 +128,10 @@ struct hb_bit_set_t unsigned hash () const { - return page_map.hash () ^ pages.hash (); + unsigned h = 0; + for (auto &map : page_map) + h = h * 31 + hb_hash (map.major) + hb_hash (pages[map.index]); + return h; } private: