From 4acaffd786a11b5bd7d41b39fc65625fd8cd5077 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 18 May 2009 05:29:29 -0400 Subject: [PATCH] [HB] Don't use G_LIKELY! --- src/hb-ot-layout-gsub-private.h | 12 ++++++------ src/hb-ot-layout-gsubgpos-private.h | 12 ++++++------ src/hb-ot-layout-open-private.h | 4 ++-- src/hb-ot-layout.cc | 6 +++--- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/hb-ot-layout-gsub-private.h b/src/hb-ot-layout-gsub-private.h index 75ff827f7..dd929c0d7 100644 --- a/src/hb-ot-layout-gsub-private.h +++ b/src/hb-ot-layout-gsub-private.h @@ -49,7 +49,7 @@ struct SingleSubstFormat1 { inline bool single_substitute (hb_codepoint_t &glyph_id) const { unsigned int index = (this+coverage) (glyph_id); - if (G_LIKELY (index == NOT_COVERED)) + if (HB_LIKELY (index == NOT_COVERED)) return false; glyph_id += deltaGlyphID; @@ -76,10 +76,10 @@ struct SingleSubstFormat2 { inline bool single_substitute (hb_codepoint_t &glyph_id) const { unsigned int index = (this+coverage) (glyph_id); - if (G_LIKELY (index == NOT_COVERED)) + if (HB_LIKELY (index == NOT_COVERED)) return false; - if (G_UNLIKELY (index >= substitute.len)) + if (HB_UNLIKELY (index >= substitute.len)) return false; glyph_id = substitute[index]; @@ -189,7 +189,7 @@ struct MultipleSubstFormat1 { inline bool substitute (LOOKUP_ARGS_DEF) const { unsigned int index = (this+coverage) (IN_CURGLYPH ()); - if (G_LIKELY (index == NOT_COVERED)) + if (HB_LIKELY (index == NOT_COVERED)) return false; return (this+sequence[index]).substitute_sequence (LOOKUP_ARGS); @@ -243,7 +243,7 @@ struct AlternateSubstFormat1 { hb_codepoint_t glyph_id = IN_CURGLYPH (); unsigned int index = (this+coverage) (glyph_id); - if (G_LIKELY (index == NOT_COVERED)) + if (HB_LIKELY (index == NOT_COVERED)) return false; const AlternateSet &alt_set = this+alternateSet[index]; @@ -426,7 +426,7 @@ struct LigatureSubstFormat1 { property & LookupFlag::MarkAttachmentType); unsigned int index = (this+coverage) (glyph_id); - if (G_LIKELY (index == NOT_COVERED)) + if (HB_LIKELY (index == NOT_COVERED)) return false; const LigatureSet &lig_set = this+ligatureSet[index]; diff --git a/src/hb-ot-layout-gsubgpos-private.h b/src/hb-ot-layout-gsubgpos-private.h index 01b7fae91..15d48bd34 100644 --- a/src/hb-ot-layout-gsubgpos-private.h +++ b/src/hb-ot-layout-gsubgpos-private.h @@ -293,7 +293,7 @@ struct ContextFormat1 { inline bool apply (LOOKUP_ARGS_DEF, apply_lookup_func_t apply_func) const { unsigned int index = (this+coverage) (IN_CURGLYPH ()); - if (G_LIKELY (index == NOT_COVERED)) + if (HB_LIKELY (index == NOT_COVERED)) return false; const RuleSet &rule_set = this+ruleSet[index]; @@ -324,7 +324,7 @@ struct ContextFormat2 { inline bool apply (LOOKUP_ARGS_DEF, apply_lookup_func_t apply_func) const { unsigned int index = (this+coverage) (IN_CURGLYPH ()); - if (G_LIKELY (index == NOT_COVERED)) + if (HB_LIKELY (index == NOT_COVERED)) return false; const ClassDef &class_def = this+classDef; @@ -363,7 +363,7 @@ struct ContextFormat3 { inline bool apply (LOOKUP_ARGS_DEF, apply_lookup_func_t apply_func) const { unsigned int index = (this+coverage[0]) (IN_CURGLYPH ()); - if (G_LIKELY (index == NOT_COVERED)) + if (HB_LIKELY (index == NOT_COVERED)) return false; const LookupRecord *lookupRecord = (const LookupRecord *) @@ -531,7 +531,7 @@ struct ChainContextFormat1 { inline bool apply (LOOKUP_ARGS_DEF, apply_lookup_func_t apply_func) const { unsigned int index = (this+coverage) (IN_CURGLYPH ()); - if (G_LIKELY (index == NOT_COVERED)) + if (HB_LIKELY (index == NOT_COVERED)) return false; const ChainRuleSet &rule_set = this+ruleSet[index]; @@ -560,7 +560,7 @@ struct ChainContextFormat2 { inline bool apply (LOOKUP_ARGS_DEF, apply_lookup_func_t apply_func) const { unsigned int index = (this+coverage) (IN_CURGLYPH ()); - if (G_LIKELY (index == NOT_COVERED)) + if (HB_LIKELY (index == NOT_COVERED)) return false; const ClassDef &backtrack_class_def = this+backtrackClassDef; @@ -619,7 +619,7 @@ struct ChainContextFormat3 { ((const char *) &backtrack + backtrack.get_size ()); unsigned int index = (this+input[0]) (IN_CURGLYPH ()); - if (G_LIKELY (index == NOT_COVERED)) + if (HB_LIKELY (index == NOT_COVERED)) return false; const OffsetArrayOf &lookahead = * (const OffsetArrayOf *) diff --git a/src/hb-ot-layout-open-private.h b/src/hb-ot-layout-open-private.h index 98a249933..fae2d4e27 100644 --- a/src/hb-ot-layout-open-private.h +++ b/src/hb-ot-layout-open-private.h @@ -490,11 +490,11 @@ struct OpenTypeFontFile { private: inline const char* operator[] (const OpenTypeTable& table) const { - if (G_UNLIKELY (table.offset == 0)) return NULL; + if (HB_UNLIKELY (table.offset == 0)) return NULL; return ((const char*)this) + table.offset; } inline char* operator[] (const OpenTypeTable& table) { - if (G_UNLIKELY (table.offset == 0)) return NULL; + if (HB_UNLIKELY (table.offset == 0)) return NULL; return ((char*)this) + table.offset; } diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 2e18a0516..6804a08bd 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -216,7 +216,7 @@ hb_ot_layout_set_glyph_class (hb_ot_layout_t *layout, hb_ot_layout_class_t gdef_klass; int len = layout->new_gdef.len; - if (G_UNLIKELY (glyph > 65535)) + if (HB_UNLIKELY (glyph > 65535)) return; if (glyph >= len) { @@ -228,7 +228,7 @@ hb_ot_layout_set_glyph_class (hb_ot_layout_t *layout, new_len = 65535; new_klasses = (unsigned char *) realloc (layout->new_gdef.klasses, new_len * sizeof (unsigned char)); - if (G_UNLIKELY (!new_klasses)) + if (HB_UNLIKELY (!new_klasses)) return; memset (new_klasses + len, 0, new_len - len); @@ -257,7 +257,7 @@ hb_ot_layout_build_glyph_classes (hb_ot_layout_t *layout, unsigned char *klasses, uint16_t count) { - if (G_UNLIKELY (!count || !glyphs || !klasses)) + if (HB_UNLIKELY (!count || !glyphs || !klasses)) return; if (layout->new_gdef.len == 0) {