diff --git a/src/hb-map.hh b/src/hb-map.hh index 3c75f544e..bfb1b3f76 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh @@ -65,25 +65,22 @@ struct hb_hashmap_t struct item_t { -#define HASH_BITS 29 K key; - uint32_t hash : HASH_BITS; + uint32_t hash : 30; uint32_t is_used_ : 1; uint32_t is_tombstone_ : 1; - uint32_t is_real_ : 1; V value; item_t () : key (), hash (0), - is_used_ (false), is_tombstone_ (false), is_real_ (false), + is_used_ (false), is_tombstone_ (false), value () {} bool is_used () const { return is_used_; } - void set_used (bool is_used) { is_used_ = is_used; set_real (); } + void set_used (bool is_used) { is_used_ = is_used; } bool is_tombstone () const { return is_tombstone_; } - void set_tombstone (bool is_tombstone) { is_tombstone_ = is_tombstone; set_real (); } - bool is_real () const { return is_real_; } - void set_real () { is_real_ = is_used_ && !is_tombstone_; } + void set_tombstone (bool is_tombstone) { is_tombstone_ = is_tombstone; } + bool is_real () const { return is_used_ && !is_tombstone_; } template @@ -363,7 +360,7 @@ struct hb_hashmap_t item_t& item_for_hash (const K &key, uint32_t hash) const { - hash &= (1u << HASH_BITS) - 1; + hash &= 0x3FFFFFFF; // We only store lower 30bit of hash unsigned int i = hash % prime; unsigned int step = 0; unsigned int tombstone = (unsigned) -1;