From fc8ce2a8914929c4332ab78c3a5fb088b271f752 Mon Sep 17 00:00:00 2001 From: Filippo Gentile Date: Mon, 9 Jan 2023 21:46:31 +0100 Subject: [PATCH] endianess: fix MinGW on Windows MinGW has _byteswap_ushort and the other functions like MSVC but needs additional header. --- server/src/utils/endian.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/src/utils/endian.hpp b/server/src/utils/endian.hpp index eccf6912..18cc8381 100644 --- a/server/src/utils/endian.hpp +++ b/server/src/utils/endian.hpp @@ -24,7 +24,14 @@ #define TRAINTASTIC_SERVER_UTILS_ENDIAN_HPP #include -#ifdef _MSC_VER + + +#if defined(__MINGW32__) || defined(__MINGW64__) +//Needed for definition of _byteswap_ushort, _byteswap_ulong and _byteswap_uint64 on MinGW +#include +#endif + +#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__) #define bswap_16(x) _byteswap_ushort(x) #define bswap_32(x) _byteswap_ulong(x) #define bswap_64(x) _byteswap_uint64(x)