From 183a5cb11435901f1b1c7de26953491cb6b41bf0 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Wed, 6 Jun 2018 01:54:37 +0100 Subject: [PATCH] Add unaligned uint 16, 32, 64 typedefs --- src/stdafx.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/stdafx.h b/src/stdafx.h index 7fbd61f560..a145d645c2 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -456,6 +456,16 @@ assert_compile(SIZE_MAX >= UINT32_MAX); #define unlikely(x) (x) #endif /* __GNUC__ || __clang__ */ +#if defined(__GNUC__) || defined(__clang__) +__attribute__((aligned(1))) typedef uint16 unaligned_uint16; +__attribute__((aligned(1))) typedef uint32 unaligned_uint32; +__attribute__((aligned(1))) typedef uint64 unaligned_uint64; +#else +typedef uint16 unaligned_uint16; +typedef uint32 unaligned_uint32; +typedef uint64 unaligned_uint64; +#endif /* __GNUC__ || __clang__ */ + void NORETURN CDECL usererror(const char *str, ...) WARN_FORMAT(1, 2); void NORETURN CDECL error(const char *str, ...) WARN_FORMAT(1, 2); void NORETURN CDECL assert_msg_error(int line, const char *file, const char *expr, const char *str, ...) WARN_FORMAT(4, 5);