Convert unsigned enum class consts to static constexpr

Part of https://github.com/harfbuzz/harfbuzz/issues/1553
This commit is contained in:
Behdad Esfahbod 2019-01-22 12:11:24 +01:00
parent ef00654962
commit 5d4b0377b9
7 changed files with 11 additions and 11 deletions

View File

@ -77,7 +77,7 @@ struct LookupFormat0
template <typename T>
struct LookupSegmentSingle
{
enum { TerminationWordCount = 2u };
static constexpr unsigned TerminationWordCount = 2u;
int cmp (hb_codepoint_t g) const
{ return g < first ? -1 : g <= last ? 0 : +1 ; }
@ -136,7 +136,7 @@ struct LookupFormat2
template <typename T>
struct LookupSegmentArray
{
enum { TerminationWordCount = 2u };
static constexpr unsigned TerminationWordCount = 2u;
const T* get_value (hb_codepoint_t glyph_id, const void *base) const
{
@ -207,7 +207,7 @@ struct LookupFormat4
template <typename T>
struct LookupSingle
{
enum { TerminationWordCount = 1u };
static constexpr unsigned TerminationWordCount = 1u;
int cmp (hb_codepoint_t g) const { return glyph.cmp (g); }

View File

@ -980,7 +980,7 @@ struct kerx : KerxTable<kerx>
friend struct KerxTable<kerx>;
static constexpr hb_tag_t tableTag = HB_AAT_TAG_kerx;
enum { minVersion = 2u };
static constexpr unsigned minVersion = 2u;
typedef KerxSubTableHeader SubTableHeader;
typedef SubTableHeader::Types Types;

View File

@ -119,7 +119,7 @@ struct hb_buffer_t
/* Text before / after the main buffer contents.
* Always in Unicode, and ordered outward.
* Index 0 is for "pre-context", 1 for "post-context". */
enum { CONTEXT_LENGTH = 5u };
static constexpr unsigned CONTEXT_LENGTH = 5u;
hb_codepoint_t context[2][CONTEXT_LENGTH];
unsigned int context_len[2];

View File

@ -159,7 +159,7 @@ typedef HBUINT16 GlyphID;
/* Script/language-system/feature index */
struct Index : HBUINT16 {
enum { NOT_FOUND_INDEX = 0xFFFFu };
static constexpr unsigned NOT_FOUND_INDEX = 0xFFFFu;
};
DECLARE_NULL_NAMESPACE_BYTES (OT, Index);

View File

@ -198,7 +198,7 @@ struct KernOT : AAT::KerxTable<KernOT>
friend struct AAT::KerxTable<KernOT>;
static constexpr hb_tag_t tableTag = HB_OT_TAG_kern;
enum { minVersion = 0u };
static constexpr unsigned minVersion = 0u;
typedef KernOTSubTableHeader SubTableHeader;
typedef SubTableHeader::Types Types;
@ -253,7 +253,7 @@ struct KernAAT : AAT::KerxTable<KernAAT>
friend struct AAT::KerxTable<KernAAT>;
static constexpr hb_tag_t tableTag = HB_OT_TAG_kern;
enum { minVersion = 0x00010000u };
static constexpr unsigned minVersion = 0x00010000u;
typedef KernAATSubTableHeader SubTableHeader;
typedef SubTableHeader::Types Types;

View File

@ -1949,7 +1949,7 @@ struct FeatureVariationRecord
struct FeatureVariations
{
enum { NOT_FOUND_INDEX = 0xFFFFFFFFu };
static constexpr unsigned NOT_FOUND_INDEX = 0xFFFFFFFFu;
bool find_index (const int *coords, unsigned int coord_len,
unsigned int *index) const

View File

@ -1299,7 +1299,7 @@ hb_ot_layout_feature_get_characters (hb_face_t *face,
struct GSUBProxy
{
enum { table_index = 0u };
static constexpr unsigned table_index = 0u;
static constexpr bool inplace = false;
typedef OT::SubstLookup Lookup;
@ -1313,7 +1313,7 @@ struct GSUBProxy
struct GPOSProxy
{
enum { table_index = 1u };
static constexpr unsigned table_index = 1u;
static constexpr bool inplace = true;
typedef OT::PosLookup Lookup;