From ff7bf88192b0ceed3e9489c82f6b902ced37e1b4 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 20 Feb 2021 15:39:29 -0700 Subject: [PATCH] m[algs] Fix BEInt -Wnarrowing errors --- src/hb-algs.hh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/hb-algs.hh b/src/hb-algs.hh index ccb293d60..93d4acb3f 100644 --- a/src/hb-algs.hh +++ b/src/hb-algs.hh @@ -89,7 +89,7 @@ struct BEInt { public: BEInt () = default; - constexpr BEInt (Type V) : v {V} {} + constexpr BEInt (Type V) : v {uint8_t (V)} {} constexpr operator Type () const { return v; } private: uint8_t v; }; @@ -98,8 +98,8 @@ struct BEInt { public: BEInt () = default; - constexpr BEInt (Type V) : v {(V >> 8) & 0xFF, - (V ) & 0xFF} {} + constexpr BEInt (Type V) : v {uint8_t ((V >> 8) & 0xFF), + uint8_t ((V ) & 0xFF)} {} constexpr operator Type () const { #if ((defined(__GNUC__) && __GNUC__ >= 5) || defined(__clang__)) && \ @@ -125,9 +125,9 @@ struct BEInt { public: BEInt () = default; - constexpr BEInt (Type V) : v {(V >> 16) & 0xFF, - (V >> 8) & 0xFF, - (V ) & 0xFF} {} + constexpr BEInt (Type V) : v {uint8_t ((V >> 16) & 0xFF), + uint8_t ((V >> 8) & 0xFF), + uint8_t ((V ) & 0xFF)} {} constexpr operator Type () const { return (v[0] << 16) + (v[1] << 8) + (v[2] ); } @@ -138,10 +138,10 @@ struct BEInt { public: BEInt () = default; - constexpr BEInt (Type V) : v {(V >> 24) & 0xFF, - (V >> 16) & 0xFF, - (V >> 8) & 0xFF, - (V ) & 0xFF} {} + constexpr BEInt (Type V) : v {uint8_t ((V >> 24) & 0xFF), + uint8_t ((V >> 16) & 0xFF), + uint8_t ((V >> 8) & 0xFF), + uint8_t ((V ) & 0xFF)} {} constexpr operator Type () const { return (v[0] << 24) + (v[1] << 16) + (v[2] << 8)