[cache] Residual
diff --git a/src/hb-cache.hh b/src/hb-cache.hh index 3bcfc9e..e29984d 100644 --- a/src/hb-cache.hh +++ b/src/hb-cache.hh
@@ -38,12 +38,12 @@ bool thread_safe=true> struct hb_cache_t { - static_assert ((key_bits >= cache_bits), ""); - static_assert ((key_bits + value_bits - cache_bits <= 8 * sizeof (hb_atomic_int_t)), ""); - static_assert (sizeof (hb_atomic_int_t) == sizeof (unsigned int), ""); - using item_t = typename std::conditional<thread_safe, hb_atomic_int_t, int>::type; + static_assert ((key_bits >= cache_bits), ""); + static_assert ((key_bits + value_bits - cache_bits <= 8 * sizeof (item_t)), ""); + static_assert (sizeof (item_t) == sizeof (unsigned int), ""); + void init () { clear (); } void fini () {} @@ -57,7 +57,7 @@ { unsigned int k = key & ((1u<<cache_bits)-1); unsigned int v = values[k]; - if ((key_bits + value_bits - cache_bits == 8 * sizeof (hb_atomic_int_t) && v == (unsigned int) -1) || + if ((key_bits + value_bits - cache_bits == 8 * sizeof (item_t) && v == (unsigned int) -1) || (v >> value_bits) != (key >> cache_bits)) return false; *value = v & ((1u<<value_bits)-1);