struct hb_cache_t
{
ASSERT_STATIC (key_bits >= cache_bits);
- ASSERT_STATIC (key_bits + value_bits - cache_bits < 8 * sizeof (hb_atomic_int_t));
+ ASSERT_STATIC (key_bits + value_bits - cache_bits < 8 * sizeof (unsigned int));
inline void clear (void)
{
inline bool get (unsigned int key, unsigned int *value)
{
unsigned int k = key & ((1<<cache_bits)-1);
- unsigned int v = hb_atomic_int_get (values[k]);
+ unsigned int v = values[k];
if ((v >> value_bits) != (key >> cache_bits))
return false;
}
return false; /* Overflows */
unsigned int k = key & ((1<<cache_bits)-1);
unsigned int v = ((key>>cache_bits)<<value_bits) | value;
- hb_atomic_int_set (values[k], v);
+ values[k] = v;
return true;
}
private:
- hb_atomic_int_t values[1<<cache_bits];
+ unsigned int values[1<<cache_bits];
};
typedef hb_cache_t<21, 16, 8> hb_cmap_cache_t;