[perf] Micro-optimize

This commit is contained in:
Behdad Esfahbod 2015-11-02 17:58:12 -08:00
parent 76a5310a83
commit ed2024ef93
1 changed files with 14 additions and 9 deletions

View File

@ -223,19 +223,24 @@ enum {
static inline void
_hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *unicode)
{
unsigned int gen_cat = (unsigned int) unicode->general_category (info->codepoint);
unsigned int u = info->codepoint;
unsigned int gen_cat = (unsigned int) unicode->general_category (u);
unsigned int props = gen_cat;
if (unlikely (unicode->is_default_ignorable (info->codepoint)))
if (u >= 0x80)
{
props |= UPROPS_MASK_IGNORABLE;
if (info->codepoint == 0x200Cu) props |= UPROPS_MASK_ZWNJ;
if (info->codepoint == 0x200Du) props |= UPROPS_MASK_ZWJ;
}
else if (unlikely (HB_UNICODE_GENERAL_CATEGORY_IS_MARK (gen_cat)))
{
props |= unicode->modified_combining_class (info->codepoint)<<8;
if (unlikely (unicode->is_default_ignorable (u)))
{
props |= UPROPS_MASK_IGNORABLE;
if (u == 0x200Cu) props |= UPROPS_MASK_ZWNJ;
if (u == 0x200Du) props |= UPROPS_MASK_ZWJ;
}
else if (unlikely (HB_UNICODE_GENERAL_CATEGORY_IS_MARK (gen_cat)))
{
props |= unicode->modified_combining_class (info->codepoint)<<8;
}
}
info->unicode_props() = props;
}