diff --git a/src/hb-cache.hh b/src/hb-cache.hh index ec2e8635f91f09ac0a531b11a323dc6c64555b3e..70e966e8d1dadae2859ff121ca4f1c0eb4c289a6 100644 --- a/src/hb-cache.hh +++ b/src/hb-cache.hh @@ -36,7 +36,8 @@ template = cache_bits), ""); - static_assert ((key_bits + value_bits - cache_bits <= 8 * sizeof (unsigned int)), ""); + static_assert ((key_bits + value_bits - cache_bits <= 8 * sizeof (hb_atomic_int_t)), ""); + static_assert (sizeof (hb_atomic_int_t) == sizeof (unsigned int)); inline void init (void) { clear (); } inline void fini (void) {} @@ -51,7 +52,8 @@ struct hb_cache_t { unsigned int k = key & ((1u<> value_bits) != (key >> cache_bits)) + if ((key_bits + value_bits - cache_bits == 8 * sizeof (hb_atomic_int_t) && v == (unsigned int) -1) || + (v >> value_bits) != (key >> cache_bits)) return false; *value = v & ((1u<