removed a useless restriction from Watcom version of SDL_Swap32() also did a little whitespace tidy-up.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
diff --git a/include/SDL_endian.h b/include/SDL_endian.h
index cf2eba9..ae78be4 100644
--- a/include/SDL_endian.h
+++ b/include/SDL_endian.h
@@ -157,9 +157,9 @@ SDL_Swap32(Uint32 x)
{
Uint32 result;
- __asm__("rlwimi %0,%2,24,16,23": "=&r"(result):"0"(x >> 24), "r"(x));
- __asm__("rlwimi %0,%2,8,8,15": "=&r"(result):"0"(result), "r"(x));
- __asm__("rlwimi %0,%2,24,0,7": "=&r"(result):"0"(result), "r"(x));
+ __asm__("rlwimi %0,%2,24,16,23": "=&r"(result): "0" (x>>24), "r"(x));
+ __asm__("rlwimi %0,%2,8,8,15" : "=&r"(result): "0" (result), "r"(x));
+ __asm__("rlwimi %0,%2,24,0,7" : "=&r"(result): "0" (result), "r"(x));
return result;
}
#elif defined(__GNUC__) && defined(__aarch64__)
@@ -178,19 +178,10 @@ SDL_Swap32(Uint32 x)
}
#elif defined(__WATCOMC__) && defined(__386__)
extern _inline Uint32 SDL_Swap32(Uint32);
-#ifndef __SW_3 /* 486+ */
#pragma aux SDL_Swap32 = \
"bswap eax" \
parm [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)
#pragma intrinsic(_byteswap_ulong)
#define SDL_Swap32(x) _byteswap_ulong(x)
@@ -211,18 +202,16 @@ SDL_Swap32(Uint32 x)
SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x)
{
- union
- {
- struct
- {
+ union {
+ struct {
Uint32 a, b;
} s;
Uint64 u;
} v;
v.u = x;
- __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1": "=r"(v.s.a), "=r"(v.s.b):"0"(v.s.a),
- "1"(v.s.
- b));
+ __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
+ : "=r"(v.s.a), "=r"(v.s.b)
+ : "0" (v.s.a), "1"(v.s.b));
return v.u;
}
#elif defined(__GNUC__) && defined(__x86_64__)
@@ -264,8 +253,7 @@ SDL_Swap64(Uint64 x)
SDL_FORCE_INLINE float
SDL_SwapFloat(float x)
{
- union
- {
+ union {
float f;
Uint32 ui32;
} swapper;
@@ -281,22 +269,22 @@ SDL_SwapFloat(float x)
*/
/* @{ */
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
-#define SDL_SwapLE16(X) (X)
-#define SDL_SwapLE32(X) (X)
-#define SDL_SwapLE64(X) (X)
+#define SDL_SwapLE16(X) (X)
+#define SDL_SwapLE32(X) (X)
+#define SDL_SwapLE64(X) (X)
#define SDL_SwapFloatLE(X) (X)
-#define SDL_SwapBE16(X) SDL_Swap16(X)
-#define SDL_SwapBE32(X) SDL_Swap32(X)
-#define SDL_SwapBE64(X) SDL_Swap64(X)
+#define SDL_SwapBE16(X) SDL_Swap16(X)
+#define SDL_SwapBE32(X) SDL_Swap32(X)
+#define SDL_SwapBE64(X) SDL_Swap64(X)
#define SDL_SwapFloatBE(X) SDL_SwapFloat(X)
#else
-#define SDL_SwapLE16(X) SDL_Swap16(X)
-#define SDL_SwapLE32(X) SDL_Swap32(X)
-#define SDL_SwapLE64(X) SDL_Swap64(X)
+#define SDL_SwapLE16(X) SDL_Swap16(X)
+#define SDL_SwapLE32(X) SDL_Swap32(X)
+#define SDL_SwapLE64(X) SDL_Swap64(X)
#define SDL_SwapFloatLE(X) SDL_SwapFloat(X)
-#define SDL_SwapBE16(X) (X)
-#define SDL_SwapBE32(X) (X)
-#define SDL_SwapBE64(X) (X)
+#define SDL_SwapBE16(X) (X)
+#define SDL_SwapBE32(X) (X)
+#define SDL_SwapBE64(X) (X)
#define SDL_SwapFloatBE(X) (X)
#endif
/* @} *//* Swap to native */