1234567891011121314151617181920212223242526272829303132 |
- Author: Guy Martin <gmsoft@gentoo.org>
- Description: This patch make the check for endianness actually occur.
- Bug-Gentoo: https://bugs.gentoo.org/show_bug.cgi?id=222301
- Origin: https://bugs.gentoo.org/attachment.cgi?id=241251
- --- a/source/base/all/all.h
- +++ b/source/base/all/all.h
- @@ -61,7 +61,8 @@ memmove((ptr), &__tmp, sizeof(*(ptr)));
- #define put_unaligned(ptr, val) ((void)( *(ptr) = (val) ))
- #endif /* __EMULATE_UNALIGNED__ */
-
- -#ifdef __BIG_ENDIAN__
- +#include <endian.h>
- +#if __BYTE_ORDER == __BIG_ENDIAN
- #define ADJUST_ENDIANNESS16(Ptr) {\
- USHORT x = get_unaligned((USHORT*) (Ptr));\
- put_unaligned((USHORT*) (Ptr), x >> 8 | x << 8);\
- @@ -78,10 +79,12 @@ memmove((ptr), &__tmp, sizeof(*(ptr)));
- x2 = x2 >> 16 | x2 << 16;\
- put_unaligned(((ULONG*) (Ptr)), (x2&0xff00ff00) >> 8 | (x2&0x00ff00ff) << 8);\
- }
- -#else
- +#elif __BYTE_ORDER == __LITTLE_ENDIAN
- #define ADJUST_ENDIANNESS16(Ptr)
- #define ADJUST_ENDIANNESS32(Ptr)
- #define ADJUST_ENDIANNESS64(Ptr)
- +#else
- +#error Please define system endianness
- #endif
-
- #endif
|