m Rename ASSERT_STATIC_EXPR_ZERO to static_assert_expr
This commit is contained in:
parent
59cfffb1af
commit
61f8d0e57d
@ -142,7 +142,7 @@
|
||||
OT_UARRAY(Name##Substitute, OT_LIST(ToGlyphs)) \
|
||||
) \
|
||||
OT_COVERAGE1(Name##Coverage, OT_LIST(FromGlyphs)) \
|
||||
/* ASSERT_STATIC_EXPR_ZERO (len(FromGlyphs) == len(ToGlyphs)) */
|
||||
/* static_assert_expr (len(FromGlyphs) == len(ToGlyphs)) */
|
||||
|
||||
#define OT_SUBLOOKUP_LIGATURE_SUBST_FORMAT1(Name, FirstGlyphs, LigatureSetOffsets) \
|
||||
OT_SUBLOOKUP(Name, 1, \
|
||||
@ -151,7 +151,7 @@
|
||||
OT_UARRAY(Name##LigatureSetOffsetsArray, OT_LIST(LigatureSetOffsets)) \
|
||||
) \
|
||||
OT_COVERAGE1(Name##Coverage, OT_LIST(FirstGlyphs)) \
|
||||
/* ASSERT_STATIC_EXPR_ZERO (len(FirstGlyphs) == len(LigatureSetOffsets)) */
|
||||
/* static_assert_expr (len(FirstGlyphs) == len(LigatureSetOffsets)) */
|
||||
|
||||
#define OT_LIGATURE_SET(Name, LigatureSetOffsets) \
|
||||
OT_UARRAY(Name, OT_LIST(LigatureSetOffsets))
|
||||
|
@ -175,7 +175,7 @@ enum indic_matra_category_t {
|
||||
|
||||
#define INDIC_COMBINE_CATEGORIES(S,M) \
|
||||
( \
|
||||
ASSERT_STATIC_EXPR_ZERO (S < 255 && M < 255) + \
|
||||
static_assert_expr (S < 255 && M < 255) + \
|
||||
( S | \
|
||||
( \
|
||||
( \
|
||||
|
@ -444,7 +444,7 @@ static int HB_UNUSED _hb_errno = 0;
|
||||
/* Static-assert as expression. */
|
||||
template <bool cond> class hb_assert_constant_t;
|
||||
template <> class hb_assert_constant_t<true> {};
|
||||
#define ASSERT_STATIC_EXPR_ZERO(_cond) (0u * (unsigned int) sizeof (hb_assert_constant_t<_cond>))
|
||||
#define static_assert_expr(_cond) (bool (0u * (unsigned int) sizeof (hb_assert_constant_t<_cond>)))
|
||||
|
||||
/* Lets assert int types. Saves trouble down the road. */
|
||||
static_assert ((sizeof (int8_t) == 1), "");
|
||||
@ -498,10 +498,10 @@ static_assert ((sizeof (hb_var_int_t) == 4), "");
|
||||
* For example, for testing "x ∈ {x1, x2, x3}" use:
|
||||
* (FLAG_UNSAFE(x) & (FLAG(x1) | FLAG(x2) | FLAG(x3)))
|
||||
*/
|
||||
#define FLAG(x) (ASSERT_STATIC_EXPR_ZERO ((unsigned)(x) < 32) + (((uint32_t) 1U) << (unsigned)(x)))
|
||||
#define FLAG(x) (static_assert_expr ((unsigned)(x) < 32) + (((uint32_t) 1U) << (unsigned)(x)))
|
||||
#define FLAG_UNSAFE(x) ((unsigned)(x) < 32 ? (((uint32_t) 1U) << (unsigned)(x)) : 0)
|
||||
#define FLAG_RANGE(x,y) (ASSERT_STATIC_EXPR_ZERO ((x) < (y)) + FLAG(y+1) - FLAG(x))
|
||||
#define FLAG64(x) (ASSERT_STATIC_EXPR_ZERO ((unsigned)(x) < 64) + (((uint64_t) 1ULL) << (unsigned)(x)))
|
||||
#define FLAG_RANGE(x,y) (static_assert_expr ((x) < (y)) + FLAG(y+1) - FLAG(x))
|
||||
#define FLAG64(x) (static_assert_expr ((unsigned)(x) < 64) + (((uint64_t) 1ULL) << (unsigned)(x)))
|
||||
#define FLAG64_UNSAFE(x) ((unsigned)(x) < 64 ? (((uint64_t) 1ULL) << (unsigned)(x)) : 0)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user