[algs] Another try at fixing BEInt constexpr
../src/hb-algs.hh:120:3: error: body of constexpr function ‘constexpr BEInt<Type, 2>::operator Type() const [with Type = short unsigned int]’ not a return-statement
This commit is contained in:
parent
ff7bf88192
commit
69464e9da0
@ -100,6 +100,8 @@ struct BEInt<Type, 2>
|
|||||||
BEInt () = default;
|
BEInt () = default;
|
||||||
constexpr BEInt (Type V) : v {uint8_t ((V >> 8) & 0xFF),
|
constexpr BEInt (Type V) : v {uint8_t ((V >> 8) & 0xFF),
|
||||||
uint8_t ((V ) & 0xFF)} {}
|
uint8_t ((V ) & 0xFF)} {}
|
||||||
|
|
||||||
|
struct __attribute__((packed)) packed_uint16_t { uint16_t v; };
|
||||||
constexpr operator Type () const
|
constexpr operator Type () const
|
||||||
{
|
{
|
||||||
#if ((defined(__GNUC__) && __GNUC__ >= 5) || defined(__clang__)) && \
|
#if ((defined(__GNUC__) && __GNUC__ >= 5) || defined(__clang__)) && \
|
||||||
@ -107,7 +109,6 @@ struct BEInt<Type, 2>
|
|||||||
(__BYTE_ORDER == __LITTLE_ENDIAN || __BYTE_ORDER == __BIG_ENDIAN)
|
(__BYTE_ORDER == __LITTLE_ENDIAN || __BYTE_ORDER == __BIG_ENDIAN)
|
||||||
/* Spoon-feed the compiler a big-endian integer with alignment 1.
|
/* Spoon-feed the compiler a big-endian integer with alignment 1.
|
||||||
* https://github.com/harfbuzz/harfbuzz/pull/1398 */
|
* https://github.com/harfbuzz/harfbuzz/pull/1398 */
|
||||||
struct __attribute__((packed)) packed_uint16_t { uint16_t v; };
|
|
||||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
return __builtin_bswap16 (((packed_uint16_t *) this)->v);
|
return __builtin_bswap16 (((packed_uint16_t *) this)->v);
|
||||||
#else /* __BYTE_ORDER == __BIG_ENDIAN */
|
#else /* __BYTE_ORDER == __BIG_ENDIAN */
|
||||||
|
Loading…
Reference in New Issue
Block a user