Rewrite ARRAY_LENGTH as a template function

Such it wouldn't apply to pointers accidentally.
This commit is contained in:
Behdad Esfahbod 2012-08-04 16:43:18 -07:00
parent 8ba8042821
commit 25326c2359
2 changed files with 8 additions and 5 deletions

View File

@ -914,9 +914,9 @@ static const uint16_t shaping_table[][4] =
#define SHAPING_TABLE_LAST 0x06D3
static const struct {
static const struct ligature_set_t {
uint16_t first;
struct {
struct ligature_pairs_t {
uint16_t second;
uint16_t ligature;
} ligatures[4];

View File

@ -66,14 +66,17 @@
#undef MIN
template <typename Type> static inline Type MIN (const Type &a, const Type &b) { return a < b ? a : b; }
template <typename Type>
static inline Type MIN (const Type &a, const Type &b) { return a < b ? a : b; }
#undef MAX
template <typename Type> static inline Type MAX (const Type &a, const Type &b) { return a > b ? a : b; }
template <typename Type>
static inline Type MAX (const Type &a, const Type &b) { return a > b ? a : b; }
#undef ARRAY_LENGTH
#define ARRAY_LENGTH(__array) ((signed int) (sizeof (__array) / sizeof (__array[0])))
template <typename Type, unsigned int n>
static inline unsigned int ARRAY_LENGTH (const Type (&a)[n]) { return n; }
#define HB_STMT_START do
#define HB_STMT_END while (0)