[Indic] Optimize Indic table storage

This commit is contained in:
Behdad Esfahbod 2011-06-28 14:13:38 -04:00
parent c4a59de6d8
commit 4ec30aec30
2 changed files with 6 additions and 3 deletions

View File

@ -121,10 +121,12 @@ enum indic_matra_category_t {
INDIC_MATRA_CATEGORY_VISUAL_ORDER_LEFT = INDIC_MATRA_CATEGORY_NOT_APPLICABLE
};
/* Note: We use ASSERT_STATIC_EXPR_ZERO() instead of ASSERT_STATIC_EXPR() and the comma operation
* because gcc fails to optimize the latter and fills the table in at runtime. */
#define INDIC_COMBINE_CATEGORIES(S,M) \
(ASSERT_STATIC_EXPR (M == INDIC_MATRA_CATEGORY_NOT_APPLICABLE || (S == INDIC_SYLLABIC_CATEGORY_VIRAMA || S == INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT)), \
ASSERT_STATIC_EXPR (S < 16 && M < 16), \
(M << 4) | S)
(ASSERT_STATIC_EXPR_ZERO (M == INDIC_MATRA_CATEGORY_NOT_APPLICABLE || (S == INDIC_SYLLABIC_CATEGORY_VIRAMA || S == INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT)) + \
ASSERT_STATIC_EXPR_ZERO (S < 16 && M < 16) + \
((M << 4) | S))
#include "hb-ot-shape-complex-indic-table.hh"

View File

@ -85,6 +85,7 @@ HB_BEGIN_DECLS
#define ASSERT_STATIC(_cond) _ASSERT_STATIC0 (__LINE__, (_cond))
#define ASSERT_STATIC_EXPR(_cond) ((void) sizeof (char[(_cond) ? 1 : -1]))
#define ASSERT_STATIC_EXPR_ZERO(_cond) (0 * sizeof (char[(_cond) ? 1 : -1]))
/* Lets assert int types. Saves trouble down the road. */