Integrate fix for Source 2's Win32 build that does '#define __i386__ 1' which causes it to hit the __i386__ case instead of the _MSC_VER case.

This commit is contained in:
Sam Lantinga 2021-09-21 18:15:10 -07:00
parent 8fee82d1fd
commit b687c0ff2c
1 changed files with 9 additions and 9 deletions

View File

@ -112,6 +112,9 @@ extern "C" {
#if HAS_BUILTIN_BSWAP16 #if HAS_BUILTIN_BSWAP16
#define SDL_Swap16(x) __builtin_bswap16(x) #define SDL_Swap16(x) __builtin_bswap16(x)
#elif defined(_MSC_VER)
#pragma intrinsic(_byteswap_ushort)
#define SDL_Swap16(x) _byteswap_ushort(x)
#elif defined(__i386__) && !HAS_BROKEN_BSWAP #elif defined(__i386__) && !HAS_BROKEN_BSWAP
SDL_FORCE_INLINE Uint16 SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x) SDL_Swap16(Uint16 x)
@ -149,9 +152,6 @@ SDL_Swap16(Uint16 x)
__asm__("rorw #8,%0": "=d"(x): "0"(x):"cc"); __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
return x; return x;
} }
#elif defined(_MSC_VER)
#pragma intrinsic(_byteswap_ushort)
#define SDL_Swap16(x) _byteswap_ushort(x)
#elif defined(__WATCOMC__) && defined(__386__) #elif defined(__WATCOMC__) && defined(__386__)
extern _inline Uint16 SDL_Swap16(Uint16); extern _inline Uint16 SDL_Swap16(Uint16);
#pragma aux SDL_Swap16 = \ #pragma aux SDL_Swap16 = \
@ -168,6 +168,9 @@ SDL_Swap16(Uint16 x)
#if HAS_BUILTIN_BSWAP32 #if HAS_BUILTIN_BSWAP32
#define SDL_Swap32(x) __builtin_bswap32(x) #define SDL_Swap32(x) __builtin_bswap32(x)
#elif defined(_MSC_VER)
#pragma intrinsic(_byteswap_ulong)
#define SDL_Swap32(x) _byteswap_ulong(x)
#elif defined(__i386__) && !HAS_BROKEN_BSWAP #elif defined(__i386__) && !HAS_BROKEN_BSWAP
SDL_FORCE_INLINE Uint32 SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x) SDL_Swap32(Uint32 x)
@ -213,9 +216,6 @@ extern _inline Uint32 SDL_Swap32(Uint32);
"bswap eax" \ "bswap eax" \
parm [eax] \ parm [eax] \
modify [eax]; modify [eax];
#elif defined(_MSC_VER)
#pragma intrinsic(_byteswap_ulong)
#define SDL_Swap32(x) _byteswap_ulong(x)
#else #else
SDL_FORCE_INLINE Uint32 SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x) SDL_Swap32(Uint32 x)
@ -227,6 +227,9 @@ SDL_Swap32(Uint32 x)
#if HAS_BUILTIN_BSWAP64 #if HAS_BUILTIN_BSWAP64
#define SDL_Swap64(x) __builtin_bswap64(x) #define SDL_Swap64(x) __builtin_bswap64(x)
#elif defined(_MSC_VER)
#pragma intrinsic(_byteswap_uint64)
#define SDL_Swap64(x) _byteswap_uint64(x)
#elif defined(__i386__) && !HAS_BROKEN_BSWAP #elif defined(__i386__) && !HAS_BROKEN_BSWAP
SDL_FORCE_INLINE Uint64 SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x) SDL_Swap64(Uint64 x)
@ -258,9 +261,6 @@ extern _inline Uint64 SDL_Swap64(Uint64);
"xchg eax,edx" \ "xchg eax,edx" \
parm [eax edx] \ parm [eax edx] \
modify [eax edx]; modify [eax edx];
#elif defined(_MSC_VER)
#pragma intrinsic(_byteswap_uint64)
#define SDL_Swap64(x) _byteswap_uint64(x)
#else #else
SDL_FORCE_INLINE Uint64 SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x) SDL_Swap64(Uint64 x)