[cache] Use short instead of int if fits
diff --git a/src/hb-cache.hh b/src/hb-cache.hh index e29984d..c87fe91 100644 --- a/src/hb-cache.hh +++ b/src/hb-cache.hh
@@ -38,11 +38,15 @@ bool thread_safe=true> struct hb_cache_t { - using item_t = typename std::conditional<thread_safe, hb_atomic_int_t, int>::type; + using item_t = typename std::conditional<thread_safe, + hb_atomic_int_t, + typename std::conditional<key_bits + value_bits - cache_bits <= 16, + short, + int>::type + >::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 () {} @@ -78,7 +82,6 @@ item_t values[1u<<cache_bits]; }; - template <bool thread_safe = true> using hb_cmap_cache_t = hb_cache_t<21, 16, 8, thread_safe>;