Convert unsigned enum class consts to static constexpr
Part of https://github.com/harfbuzz/harfbuzz/issues/1553
diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh
index 133e873..df41741 100644
--- a/src/hb-aat-layout-common.hh
+++ b/src/hb-aat-layout-common.hh
@@ -77,7 +77,7 @@
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 @@
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 @@
template <typename T>
struct LookupSingle
{
- enum { TerminationWordCount = 1u };
+ static constexpr unsigned TerminationWordCount = 1u;
int cmp (hb_codepoint_t g) const { return glyph.cmp (g); }
diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index cbb305b..ac562e4 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -980,7 +980,7 @@
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;
diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh
index ab963a5..330f88b 100644
--- a/src/hb-buffer.hh
+++ b/src/hb-buffer.hh
@@ -119,7 +119,7 @@
/* 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];
diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index 6dad1e4..67af16f 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -159,7 +159,7 @@
/* 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);
diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh
index bb563bf..ec6a3c8 100644
--- a/src/hb-ot-kern-table.hh
+++ b/src/hb-ot-kern-table.hh
@@ -198,7 +198,7 @@
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 @@
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;
diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh
index 4818a8b..39a8bba 100644
--- a/src/hb-ot-layout-common.hh
+++ b/src/hb-ot-layout-common.hh
@@ -1949,7 +1949,7 @@
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
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 3ded3ad..d32be04 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -1299,7 +1299,7 @@
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 GPOSProxy
{
- enum { table_index = 1u };
+ static constexpr unsigned table_index = 1u;
static constexpr bool inplace = true;
typedef OT::PosLookup Lookup;