Fix hb_vector_size_t

This commit is contained in:
Behdad Esfahbod 2018-06-01 17:18:57 -07:00
parent a070dfd333
commit 4ca211bce1
2 changed files with 4 additions and 3 deletions

View File

@ -549,7 +549,7 @@ _hb_ceil_to_4 (unsigned int v)
/* Global nul-content Null pool. Enlarge as necessary. */ /* Global nul-content Null pool. Enlarge as necessary. */
#define HB_NULL_POOL_SIZE 384 #define HB_NULL_POOL_SIZE 264
static_assert (HB_NULL_POOL_SIZE % sizeof (void *) == 0, "Align HB_NULL_POOL_SIZE."); static_assert (HB_NULL_POOL_SIZE % sizeof (void *) == 0, "Align HB_NULL_POOL_SIZE.");
#ifdef HB_NO_VISIBILITY #ifdef HB_NO_VISIBILITY
@ -1153,7 +1153,7 @@ struct hb_vector_size_t
union { union {
elt_t v[byte_size / sizeof (elt_t)]; elt_t v[byte_size / sizeof (elt_t)];
#if HB_VECTOR_SIZE #if HB_VECTOR_SIZE
typedef unsigned long vec_t __attribute__((vector_size (HB_VECTOR_SIZE))); typedef unsigned long vec_t __attribute__((vector_size (HB_VECTOR_SIZE / 8)));
vec_t vec[byte_size / sizeof (vec_t)]; vec_t vec[byte_size / sizeof (vec_t)];
#endif #endif
} u; } u;

View File

@ -165,7 +165,6 @@ struct hb_set_t
static inline unsigned int elt_get_max (const elt_t &elt) { return _hb_bit_storage (elt) - 1; } static inline unsigned int elt_get_max (const elt_t &elt) { return _hb_bit_storage (elt) - 1; }
typedef hb_vector_size_t<elt_t, PAGE_BITS / 8> vector_t; typedef hb_vector_size_t<elt_t, PAGE_BITS / 8> vector_t;
vector_t v;
static const unsigned int ELT_BITS = sizeof (elt_t) * 8; static const unsigned int ELT_BITS = sizeof (elt_t) * 8;
static const unsigned int ELT_MASK = ELT_BITS - 1; static const unsigned int ELT_MASK = ELT_BITS - 1;
@ -176,6 +175,8 @@ struct hb_set_t
elt_t &elt (hb_codepoint_t g) { return v[(g & MASK) / ELT_BITS]; } elt_t &elt (hb_codepoint_t g) { return v[(g & MASK) / ELT_BITS]; }
elt_t const &elt (hb_codepoint_t g) const { return v[(g & MASK) / ELT_BITS]; } elt_t const &elt (hb_codepoint_t g) const { return v[(g & MASK) / ELT_BITS]; }
elt_t mask (hb_codepoint_t g) const { return elt_t (1) << (g & ELT_MASK); } elt_t mask (hb_codepoint_t g) const { return elt_t (1) << (g & ELT_MASK); }
vector_t v;
}; };
static_assert (page_t::PAGE_BITS == sizeof (page_t) * 8, ""); static_assert (page_t::PAGE_BITS == sizeof (page_t) * 8, "");