37 #define SDL_LIL_ENDIAN 1234
38 #define SDL_BIG_ENDIAN 4321
44 #define SDL_BYTEORDER __BYTE_ORDER
46 #if defined(__hppa__) || \
47 defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
48 (defined(__MIPS__) && defined(__MISPEB__)) || \
49 defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
51 #define SDL_BYTEORDER SDL_BIG_ENDIAN
53 #define SDL_BYTEORDER SDL_LIL_ENDIAN
68 #if defined(__GNUC__) && defined(__i386__) && \
69 !(__GNUC__ == 2 && __GNUC_MINOR__ == 95 )
73 __asm__(
"xchgb %b0,%h0":
"=q"(x):
"0"(x));
76 #elif defined(__GNUC__) && defined(__x86_64__)
80 __asm__(
"xchgb %b0,%h0":
"=Q"(x):
"0"(x));
83 #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
89 __asm__(
"rlwimi %0,%2,8,16,23":
"=&r"(result):
"0"(x >> 8),
"r"(x));
92 #elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
96 __asm__(
"rorw #8,%0":
"=d"(x):
"0"(x):
"cc");
107 #if defined(__GNUC__) && defined(__i386__)
111 __asm__(
"bswap %0":
"=r"(x):
"0"(x));
114 #elif defined(__GNUC__) && defined(__x86_64__)
118 __asm__(
"bswapl %0":
"=r"(x):
"0"(x));
121 #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
127 __asm__(
"rlwimi %0,%2,24,16,23":
"=&r"(result):
"0"(x >> 24),
"r"(x));
128 __asm__(
"rlwimi %0,%2,8,8,15":
"=&r"(result):
"0"(result),
"r"(x));
129 __asm__(
"rlwimi %0,%2,24,0,7":
"=&r"(result):
"0"(result),
"r"(x));
132 #elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
136 __asm__(
"rorw #8,%0\n\tswap %0\n\trorw #8,%0":
"=d"(x):
"0"(x):
"cc");
144 ((x >> 8) & 0x0000FF00) | (x >> 24)));
148 #if defined(__GNUC__) && defined(__i386__)
161 __asm__(
"bswapl %0 ; bswapl %1 ; xchgl %0,%1":
"=r"(
v.s.a),
"=r"(
v.s.b):
"0"(
v.s.a),
166 #elif defined(__GNUC__) && defined(__x86_64__)
170 __asm__(
"bswapq %0":
"=r"(x):
"0"(x));
210 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
211 #define SDL_SwapLE16(X) (X)
212 #define SDL_SwapLE32(X) (X)
213 #define SDL_SwapLE64(X) (X)
214 #define SDL_SwapFloatLE(X) (X)
215 #define SDL_SwapBE16(X) SDL_Swap16(X)
216 #define SDL_SwapBE32(X) SDL_Swap32(X)
217 #define SDL_SwapBE64(X) SDL_Swap64(X)
218 #define SDL_SwapFloatBE(X) SDL_SwapFloat(X)
220 #define SDL_SwapLE16(X) SDL_Swap16(X)
221 #define SDL_SwapLE32(X) SDL_Swap32(X)
222 #define SDL_SwapLE64(X) SDL_Swap64(X)
223 #define SDL_SwapFloatLE(X) SDL_SwapFloat(X)
224 #define SDL_SwapBE16(X) (X)
225 #define SDL_SwapBE32(X) (X)
226 #define SDL_SwapBE64(X) (X)
227 #define SDL_SwapFloatBE(X) (X)
GLboolean GLboolean GLboolean GLboolean a
SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x)
uint32_t Uint32
An unsigned 32-bit integer type.
uint64_t Uint64
An unsigned 64-bit integer type.
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x)
#define SDL_static_cast(type, expression)
SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x)
GLdouble GLdouble GLdouble b
uint16_t Uint16
An unsigned 16-bit integer type.
SDL_FORCE_INLINE float SDL_SwapFloat(float x)