< prev index next >
src/java.desktop/share/native/libfontmanager/harfbuzz/hb-cache-private.hh
Print this page
*** 43,72 ****
memset (values, 255, sizeof (values));
}
inline bool get (unsigned int key, unsigned int *value)
{
! unsigned int k = key & ((1<<cache_bits)-1);
unsigned int v = values[k];
if ((v >> value_bits) != (key >> cache_bits))
return false;
! *value = v & ((1<<value_bits)-1);
return true;
}
inline bool set (unsigned int key, unsigned int value)
{
if (unlikely ((key >> key_bits) || (value >> value_bits)))
return false; /* Overflows */
! unsigned int k = key & ((1<<cache_bits)-1);
unsigned int v = ((key>>cache_bits)<<value_bits) | value;
values[k] = v;
return true;
}
private:
! unsigned int values[1<<cache_bits];
};
typedef hb_cache_t<21, 16, 8> hb_cmap_cache_t;
typedef hb_cache_t<16, 24, 8> hb_advance_cache_t;
--- 43,72 ----
memset (values, 255, sizeof (values));
}
inline bool get (unsigned int key, unsigned int *value)
{
! unsigned int k = key & ((1u<<cache_bits)-1);
unsigned int v = values[k];
if ((v >> value_bits) != (key >> cache_bits))
return false;
! *value = v & ((1u<<value_bits)-1);
return true;
}
inline bool set (unsigned int key, unsigned int value)
{
if (unlikely ((key >> key_bits) || (value >> value_bits)))
return false; /* Overflows */
! unsigned int k = key & ((1u<<cache_bits)-1);
unsigned int v = ((key>>cache_bits)<<value_bits) | value;
values[k] = v;
return true;
}
private:
! unsigned int values[1u<<cache_bits];
};
typedef hb_cache_t<21, 16, 8> hb_cmap_cache_t;
typedef hb_cache_t<16, 24, 8> hb_advance_cache_t;
< prev index next >