提交 4220b7bd 编写于 作者: B Behdad Esfahbod

Fix code on big-endian gcc / clang

Ouch!  We need a bigendian bot...

Fixes https://github.com/harfbuzz/harfbuzz/issues/1498
上级 c87ee722
......@@ -682,11 +682,17 @@ struct BEInt<Type, 2>
}
operator Type () const
{
#if (defined(__GNUC__) && __GNUC__ >= 5) || defined(__clang__)
#if ((defined(__GNUC__) && __GNUC__ >= 5) || defined(__clang__)) && \
defined(__BYTE_ORDER) && \
(__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 */
return ((packed_uint16_t *) this)->v;
#endif
#endif
return (v[0] << 8)
+ (v[1] );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册