mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2025-02-08 22:20:05 +01:00
removed a useless restriction from Watcom version of SDL_Swap32()
also did a little whitespace tidy-up.
This commit is contained in:
parent
b8d2185277
commit
55a385a333
@ -178,19 +178,10 @@ SDL_Swap32(Uint32 x)
|
|||||||
}
|
}
|
||||||
#elif defined(__WATCOMC__) && defined(__386__)
|
#elif defined(__WATCOMC__) && defined(__386__)
|
||||||
extern _inline Uint32 SDL_Swap32(Uint32);
|
extern _inline Uint32 SDL_Swap32(Uint32);
|
||||||
#ifndef __SW_3 /* 486+ */
|
|
||||||
#pragma aux SDL_Swap32 = \
|
#pragma aux SDL_Swap32 = \
|
||||||
"bswap eax" \
|
"bswap eax" \
|
||||||
parm [eax] \
|
parm [eax] \
|
||||||
modify [eax];
|
modify [eax];
|
||||||
#else /* 386-only */
|
|
||||||
#pragma aux SDL_Swap32 = \
|
|
||||||
"xchg al, ah" \
|
|
||||||
"ror eax, 16" \
|
|
||||||
"xchg al, ah" \
|
|
||||||
parm [eax] \
|
|
||||||
modify [eax];
|
|
||||||
#endif
|
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
#pragma intrinsic(_byteswap_ulong)
|
#pragma intrinsic(_byteswap_ulong)
|
||||||
#define SDL_Swap32(x) _byteswap_ulong(x)
|
#define SDL_Swap32(x) _byteswap_ulong(x)
|
||||||
@ -211,18 +202,16 @@ SDL_Swap32(Uint32 x)
|
|||||||
SDL_FORCE_INLINE Uint64
|
SDL_FORCE_INLINE Uint64
|
||||||
SDL_Swap64(Uint64 x)
|
SDL_Swap64(Uint64 x)
|
||||||
{
|
{
|
||||||
union
|
union {
|
||||||
{
|
struct {
|
||||||
struct
|
|
||||||
{
|
|
||||||
Uint32 a, b;
|
Uint32 a, b;
|
||||||
} s;
|
} s;
|
||||||
Uint64 u;
|
Uint64 u;
|
||||||
} v;
|
} v;
|
||||||
v.u = x;
|
v.u = x;
|
||||||
__asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1": "=r"(v.s.a), "=r"(v.s.b):"0"(v.s.a),
|
__asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
|
||||||
"1"(v.s.
|
: "=r"(v.s.a), "=r"(v.s.b)
|
||||||
b));
|
: "0" (v.s.a), "1"(v.s.b));
|
||||||
return v.u;
|
return v.u;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||||
@ -264,8 +253,7 @@ SDL_Swap64(Uint64 x)
|
|||||||
SDL_FORCE_INLINE float
|
SDL_FORCE_INLINE float
|
||||||
SDL_SwapFloat(float x)
|
SDL_SwapFloat(float x)
|
||||||
{
|
{
|
||||||
union
|
union {
|
||||||
{
|
|
||||||
float f;
|
float f;
|
||||||
Uint32 ui32;
|
Uint32 ui32;
|
||||||
} swapper;
|
} swapper;
|
||||||
|
Loading…
Reference in New Issue
Block a user