38 #ifndef __PRFCHWINTRIN_H 39 #define __PRFCHWINTRIN_H 41 static __inline__ void __attribute__((__always_inline__, __nodebug__))
42 _m_prefetch(
void *__P)
44 __builtin_prefetch (__P, 0, 3 );
57 #define SDL_LIL_ENDIAN 1234 58 #define SDL_BIG_ENDIAN 4321 64 #define SDL_BYTEORDER __BYTE_ORDER 65 #elif defined(__OpenBSD__) 67 #define SDL_BYTEORDER BYTE_ORDER 68 #elif defined(__FreeBSD__) || defined(__NetBSD__) 69 #include <sys/endian.h> 70 #define SDL_BYTEORDER BYTE_ORDER 72 #if defined(__hppa__) || \ 73 defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \ 74 (defined(__MIPS__) && defined(__MIPSEB__)) || \ 75 defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \ 77 #define SDL_BYTEORDER SDL_BIG_ENDIAN 79 #define SDL_BYTEORDER SDL_LIL_ENDIAN 94 #if (defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 2))) || \ 95 (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) 96 #define SDL_Swap16(x) __builtin_bswap16(x) 97 #elif defined(__GNUC__) && defined(__i386__) && \ 98 !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 ) 102 __asm__(
"xchgb %b0,%h0":
"=q"(x):
"0"(x));
105 #elif defined(__GNUC__) && defined(__x86_64__) 109 __asm__(
"xchgb %b0,%h0":
"=Q"(x):
"0"(x));
112 #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) 118 __asm__(
"rlwimi %0,%2,8,16,23":
"=&r"(result):
"0"(x >> 8),
"r"(x));
121 #elif defined(__GNUC__) && defined(__aarch64__) 125 __asm__(
"rev16 %w1, %w0" :
"=r"(x) :
"r"(x));
128 #elif defined(__GNUC__) && (defined(__m68k__) && !defined(__mcoldfire__)) 132 __asm__(
"rorw #8,%0":
"=d"(x):
"0"(x):
"cc");
135 #elif defined(_MSC_VER) 136 #pragma intrinsic(_byteswap_ushort) 137 #define SDL_Swap16(x) _byteswap_ushort(x) 138 #elif defined(__WATCOMC__) && defined(__386__) 140 #pragma aux SDL_Swap16 = \ 152 #if (defined(__clang__) && (__clang_major__ > 2 || (__clang_major__ == 2 && __clang_minor__ >= 6))) || \ 153 (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) 154 #define SDL_Swap32(x) __builtin_bswap32(x) 155 #elif defined(__GNUC__) && defined(__i386__) && \ 156 !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 ) 160 __asm__(
"bswap %0":
"=r"(x):
"0"(x));
163 #elif defined(__GNUC__) && defined(__x86_64__) 167 __asm__(
"bswapl %0":
"=r"(x):
"0"(x));
170 #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) 176 __asm__(
"rlwimi %0,%2,24,16,23":
"=&r"(result):
"0" (x>>24),
"r"(x));
177 __asm__(
"rlwimi %0,%2,8,8,15" :
"=&r"(result):
"0" (result),
"r"(x));
178 __asm__(
"rlwimi %0,%2,24,0,7" :
"=&r"(result):
"0" (result),
"r"(x));
181 #elif defined(__GNUC__) && defined(__aarch64__) 185 __asm__(
"rev %w1, %w0":
"=r"(x):
"r"(x));
188 #elif defined(__GNUC__) && (defined(__m68k__) && !defined(__mcoldfire__)) 192 __asm__(
"rorw #8,%0\n\tswap %0\n\trorw #8,%0":
"=d"(x):
"0"(x):
"cc");
195 #elif defined(__WATCOMC__) && defined(__386__) 197 #pragma aux SDL_Swap32 = \ 201 #elif defined(_MSC_VER) 202 #pragma intrinsic(_byteswap_ulong) 203 #define SDL_Swap32(x) _byteswap_ulong(x) 209 ((x >> 8) & 0x0000FF00) | (x >> 24)));
213 #if (defined(__clang__) && (__clang_major__ > 2 || (__clang_major__ == 2 && __clang_minor__ >= 6))) || \ 214 (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) 215 #define SDL_Swap64(x) __builtin_bswap64(x) 216 #elif defined(__GNUC__) && defined(__i386__) && \ 217 !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 ) 228 __asm__(
"bswapl %0 ; bswapl %1 ; xchgl %0,%1" 229 :
"=r"(v.s.a),
"=r"(v.s.b)
230 :
"0" (v.s.a),
"1"(v.s.b));
233 #elif defined(__GNUC__) && defined(__x86_64__) 237 __asm__(
"bswapq %0":
"=r"(x):
"0"(x));
240 #elif defined(__WATCOMC__) && defined(__386__) 242 #pragma aux SDL_Swap64 = \ 248 #elif defined(_MSC_VER) 249 #pragma intrinsic(_byteswap_uint64) 250 #define SDL_Swap64(x) _byteswap_uint64(x) 287 #if SDL_BYTEORDER == SDL_LIL_ENDIAN 288 #define SDL_SwapLE16(X) (X) 289 #define SDL_SwapLE32(X) (X) 290 #define SDL_SwapLE64(X) (X) 291 #define SDL_SwapFloatLE(X) (X) 292 #define SDL_SwapBE16(X) SDL_Swap16(X) 293 #define SDL_SwapBE32(X) SDL_Swap32(X) 294 #define SDL_SwapBE64(X) SDL_Swap64(X) 295 #define SDL_SwapFloatBE(X) SDL_SwapFloat(X) 297 #define SDL_SwapLE16(X) SDL_Swap16(X) 298 #define SDL_SwapLE32(X) SDL_Swap32(X) 299 #define SDL_SwapLE64(X) SDL_Swap64(X) 300 #define SDL_SwapFloatLE(X) SDL_SwapFloat(X) 301 #define SDL_SwapBE16(X) (X) 302 #define SDL_SwapBE32(X) (X) 303 #define SDL_SwapBE64(X) (X) 304 #define SDL_SwapFloatBE(X) (X)
SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x)
#define SDL_static_cast(type, expression)
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x)
SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x)
SDL_FORCE_INLINE float SDL_SwapFloat(float x)