Skip to content

Commit b687c0f

Browse files
committed
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.
1 parent 8fee82d commit b687c0f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

include/SDL_endian.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ extern "C" {
112112

113113
#if HAS_BUILTIN_BSWAP16
114114
#define SDL_Swap16(x) __builtin_bswap16(x)
115+
#elif defined(_MSC_VER)
116+
#pragma intrinsic(_byteswap_ushort)
117+
#define SDL_Swap16(x) _byteswap_ushort(x)
115118
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
116119
SDL_FORCE_INLINE Uint16
117120
SDL_Swap16(Uint16 x)
@@ -149,9 +152,6 @@ SDL_Swap16(Uint16 x)
149152
__asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
150153
return x;
151154
}
152-
#elif defined(_MSC_VER)
153-
#pragma intrinsic(_byteswap_ushort)
154-
#define SDL_Swap16(x) _byteswap_ushort(x)
155155
#elif defined(__WATCOMC__) && defined(__386__)
156156
extern _inline Uint16 SDL_Swap16(Uint16);
157157
#pragma aux SDL_Swap16 = \
@@ -168,6 +168,9 @@ SDL_Swap16(Uint16 x)
168168

169169
#if HAS_BUILTIN_BSWAP32
170170
#define SDL_Swap32(x) __builtin_bswap32(x)
171+
#elif defined(_MSC_VER)
172+
#pragma intrinsic(_byteswap_ulong)
173+
#define SDL_Swap32(x) _byteswap_ulong(x)
171174
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
172175
SDL_FORCE_INLINE Uint32
173176
SDL_Swap32(Uint32 x)
@@ -213,9 +216,6 @@ extern _inline Uint32 SDL_Swap32(Uint32);
213216
"bswap eax" \
214217
parm [eax] \
215218
modify [eax];
216-
#elif defined(_MSC_VER)
217-
#pragma intrinsic(_byteswap_ulong)
218-
#define SDL_Swap32(x) _byteswap_ulong(x)
219219
#else
220220
SDL_FORCE_INLINE Uint32
221221
SDL_Swap32(Uint32 x)
@@ -227,6 +227,9 @@ SDL_Swap32(Uint32 x)
227227

228228
#if HAS_BUILTIN_BSWAP64
229229
#define SDL_Swap64(x) __builtin_bswap64(x)
230+
#elif defined(_MSC_VER)
231+
#pragma intrinsic(_byteswap_uint64)
232+
#define SDL_Swap64(x) _byteswap_uint64(x)
230233
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
231234
SDL_FORCE_INLINE Uint64
232235
SDL_Swap64(Uint64 x)
@@ -258,9 +261,6 @@ extern _inline Uint64 SDL_Swap64(Uint64);
258261
"xchg eax,edx" \
259262
parm [eax edx] \
260263
modify [eax edx];
261-
#elif defined(_MSC_VER)
262-
#pragma intrinsic(_byteswap_uint64)
263-
#define SDL_Swap64(x) _byteswap_uint64(x)
264264
#else
265265
SDL_FORCE_INLINE Uint64
266266
SDL_Swap64(Uint64 x)

0 commit comments

Comments
 (0)