From 69464e9da04b9e9b7f5ac33688d3832b84a8318d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 20 Feb 2021 15:42:44 -0700 Subject: [PATCH] [algs] Another try at fixing BEInt constexpr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ../src/hb-algs.hh:120:3: error: body of constexpr function ‘constexpr BEInt::operator Type() const [with Type = short unsigned int]’ not a return-statement --- src/hb-algs.hh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hb-algs.hh b/src/hb-algs.hh index 93d4acb3f..b053923df 100644 --- a/src/hb-algs.hh +++ b/src/hb-algs.hh @@ -100,6 +100,8 @@ struct BEInt BEInt () = default; constexpr BEInt (Type V) : v {uint8_t ((V >> 8) & 0xFF), uint8_t ((V ) & 0xFF)} {} + + struct __attribute__((packed)) packed_uint16_t { uint16_t v; }; constexpr operator Type () const { #if ((defined(__GNUC__) && __GNUC__ >= 5) || defined(__clang__)) && \ @@ -107,7 +109,6 @@ struct BEInt (__BYTE_ORDER == __LITTLE_ENDIAN || __BYTE_ORDER == __BIG_ENDIAN) /* Spoon-feed the compiler a big-endian integer with alignment 1. * https://github.com/harfbuzz/harfbuzz/pull/1398 */ - struct __attribute__((packed)) packed_uint16_t { uint16_t v; }; #if __BYTE_ORDER == __LITTLE_ENDIAN return __builtin_bswap16 (((packed_uint16_t *) this)->v); #else /* __BYTE_ORDER == __BIG_ENDIAN */