diff --git a/src/stdafx.h b/src/stdafx.h --- a/src/stdafx.h +++ b/src/stdafx.h @@ -428,6 +428,16 @@ static_assert(SIZE_MAX >= UINT32_MAX); /* For the FMT library we only want to use the headers, not link to some library. */ #define FMT_HEADER_ONLY +#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); #define NOT_REACHED() error("NOT_REACHED triggered at line %i of %s", __LINE__, __FILE__)