From 8f0b64fb6988f9502d2c5e39768a9af133d9a83f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 29 Jul 2011 17:02:48 -0400 Subject: [PATCH] Minor --- src/hb-ot-shape-complex-arabic.cc | 6 +++--- src/hb-private.hh | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index 942edc7d6..02df53369 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -61,21 +61,21 @@ static unsigned int get_joining_type (hb_codepoint_t u, hb_unicode_general_categ { /* TODO Macroize the magic bit operations */ - if (likely (hb_codepoint_in_range (u, JOINING_TABLE_FIRST, JOINING_TABLE_LAST))) { + if (likely (hb_in_range (u, JOINING_TABLE_FIRST, JOINING_TABLE_LAST))) { unsigned int j_type = joining_table[u - JOINING_TABLE_FIRST]; if (likely (j_type != JOINING_TYPE_X)) return j_type; } /* Mongolian joining data is not in ArabicJoining.txt yet */ - if (unlikely (hb_codepoint_in_range (u, 0x1800, 0x18AF))) + if (unlikely (hb_in_range (u, 0x1800, 0x18AF))) { /* All letters, SIBE SYLLABLE BOUNDARY MARKER, and NIRUGU are D */ if (gen_cat == HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER || u == 0x1807 || u == 0x180A) return JOINING_TYPE_D; } - if (unlikely (hb_codepoint_in_range (u, 0x200C, 0x200D))) { + if (unlikely (hb_in_range (u, 0x200C, 0x200D))) { return u == 0x200C ? JOINING_TYPE_U : JOINING_TYPE_C; } diff --git a/src/hb-private.hh b/src/hb-private.hh index 6c19d374c..b5277a521 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -573,13 +573,14 @@ HB_BEGIN_DECLS /* Misc */ +HB_END_DECLS /* Pre-mature optimization: * Checks for lo <= u <= hi but with an optimization if lo and hi * are only different in a contiguous set of lower-most bits. */ -static inline bool -hb_codepoint_in_range (hb_codepoint_t u, hb_codepoint_t lo, hb_codepoint_t hi) +template inline bool +hb_in_range (T u, T lo, T hi) { if ( ((lo^hi) & lo) == 0 && ((lo^hi) & hi) == (lo^hi) && @@ -589,10 +590,13 @@ hb_codepoint_in_range (hb_codepoint_t u, hb_codepoint_t lo, hb_codepoint_t hi) return lo <= u && u <= hi; } +HB_BEGIN_DECLS + /* Useful for set-operations on small enums */ #define FLAG(x) (1<<(x)) + HB_END_DECLS #endif /* HB_PRIVATE_HH */