1b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet/* 2b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet SDL - Simple DirectMedia Layer 34458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall Copyright (C) 1997-2012 Sam Lantinga 4b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet 5b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet This library is free software; you can redistribute it and/or 6b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet modify it under the terms of the GNU Lesser General Public 7b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet License as published by the Free Software Foundation; either 8b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet version 2.1 of the License, or (at your option) any later version. 9b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet 10b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet This library is distributed in the hope that it will be useful, 11b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet but WITHOUT ANY WARRANTY; without even the implied warranty of 12b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet Lesser General Public License for more details. 14b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet 15b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet You should have received a copy of the GNU Lesser General Public 16b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet License along with this library; if not, write to the Free Software 17b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet 19b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet Sam Lantinga 20b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet slouken@libsdl.org 21b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet*/ 22b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet 234458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall/** 244458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall * @file SDL_endian.h 254458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall * Functions for reading and writing endian-specific values 264458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall */ 27b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet 28b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#ifndef _SDL_endian_h 29b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#define _SDL_endian_h 30b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet 31b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#include "SDL_stdinc.h" 32b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet 334458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall/** @name SDL_ENDIANs 344458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall * The two types of endianness 354458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall */ 364458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall/*@{*/ 37b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#define SDL_LIL_ENDIAN 1234 38b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#define SDL_BIG_ENDIAN 4321 394458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall/*@}*/ 40b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet 41b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */ 424458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall#ifdef __linux__ 434458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall#include <endian.h> 444458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall#define SDL_BYTEORDER __BYTE_ORDER 454458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall#else /* __linux __ */ 46b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#if defined(__hppa__) || \ 47b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \ 48b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet (defined(__MIPS__) && defined(__MISPEB__)) || \ 49b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \ 50b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet defined(__sparc__) 51b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#define SDL_BYTEORDER SDL_BIG_ENDIAN 52b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#else 53b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#define SDL_BYTEORDER SDL_LIL_ENDIAN 54b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#endif 554458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall#endif /* __linux __ */ 56b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#endif /* !SDL_BYTEORDER */ 57b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet 58b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet 59b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#include "begin_code.h" 60b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet/* Set up for C function definitions, even when using C++ */ 61b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#ifdef __cplusplus 62b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohetextern "C" { 63b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#endif 64b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet 654458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall/** 664458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall * @name SDL_Swap Functions 674458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall * Use inline functions for compilers that support them, and static 684458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall * functions for those that do not. Because these functions become 694458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall * static for compilers that do not support inline functions, this 704458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall * header should only be included in files that actually use them. 714458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall */ 724458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall/*@{*/ 73b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#if defined(__GNUC__) && defined(__i386__) && \ 74b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */) 75b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohetstatic __inline__ Uint16 SDL_Swap16(Uint16 x) 76b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet{ 77b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet __asm__("xchgb %b0,%h0" : "=q" (x) : "0" (x)); 78b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet return x; 79b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet} 80b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#elif defined(__GNUC__) && defined(__x86_64__) 81b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohetstatic __inline__ Uint16 SDL_Swap16(Uint16 x) 82b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet{ 83b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet __asm__("xchgb %b0,%h0" : "=Q" (x) : "0" (x)); 84b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet return x; 85b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet} 86b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) 87b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohetstatic __inline__ Uint16 SDL_Swap16(Uint16 x) 88b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet{ 894458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall int result; 90b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet 91b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet __asm__("rlwimi %0,%2,8,16,23" : "=&r" (result) : "0" (x >> 8), "r" (x)); 924458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall return (Uint16)result; 93b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet} 944458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall#elif defined(__GNUC__) && (defined(__m68k__) && !defined(__mcoldfire__)) 95b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohetstatic __inline__ Uint16 SDL_Swap16(Uint16 x) 96b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet{ 97b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet __asm__("rorw #8,%0" : "=d" (x) : "0" (x) : "cc"); 98b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet return x; 99b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet} 100b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#else 101b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohetstatic __inline__ Uint16 SDL_Swap16(Uint16 x) { 1024458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall return SDL_static_cast(Uint16, ((x<<8)|(x>>8))); 103b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet} 104b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#endif 105b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet 106b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#if defined(__GNUC__) && defined(__i386__) && \ 107b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */) 108b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohetstatic __inline__ Uint32 SDL_Swap32(Uint32 x) 109b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet{ 110b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet __asm__("bswap %0" : "=r" (x) : "0" (x)); 111b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet return x; 112b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet} 113b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#elif defined(__GNUC__) && defined(__x86_64__) 114b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohetstatic __inline__ Uint32 SDL_Swap32(Uint32 x) 115b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet{ 116b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet __asm__("bswapl %0" : "=r" (x) : "0" (x)); 117b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet return x; 118b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet} 119b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) 120b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohetstatic __inline__ Uint32 SDL_Swap32(Uint32 x) 121b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet{ 122b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet Uint32 result; 123b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet 124b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet __asm__("rlwimi %0,%2,24,16,23" : "=&r" (result) : "0" (x>>24), "r" (x)); 125b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet __asm__("rlwimi %0,%2,8,8,15" : "=&r" (result) : "0" (result), "r" (x)); 126b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet __asm__("rlwimi %0,%2,24,0,7" : "=&r" (result) : "0" (result), "r" (x)); 127b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet return result; 128b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet} 1294458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall#elif defined(__GNUC__) && (defined(__m68k__) && !defined(__mcoldfire__)) 130b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohetstatic __inline__ Uint32 SDL_Swap32(Uint32 x) 131b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet{ 132b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0" : "=d" (x) : "0" (x) : "cc"); 133b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet return x; 134b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet} 135b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#else 136b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohetstatic __inline__ Uint32 SDL_Swap32(Uint32 x) { 1374458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall return SDL_static_cast(Uint32, ((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24))); 138b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet} 139b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#endif 140b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet 141b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#ifdef SDL_HAS_64BIT_TYPE 142b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#if defined(__GNUC__) && defined(__i386__) && \ 143b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet !(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */) 144b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohetstatic __inline__ Uint64 SDL_Swap64(Uint64 x) 145b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet{ 146b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet union { 147b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet struct { Uint32 a,b; } s; 148b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet Uint64 u; 149b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet } v; 150b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet v.u = x; 151b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1" 152b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet : "=r" (v.s.a), "=r" (v.s.b) 153b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet : "0" (v.s.a), "1" (v.s.b)); 154b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet return v.u; 155b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet} 156b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#elif defined(__GNUC__) && defined(__x86_64__) 157b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohetstatic __inline__ Uint64 SDL_Swap64(Uint64 x) 158b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet{ 159b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet __asm__("bswapq %0" : "=r" (x) : "0" (x)); 160b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet return x; 161b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet} 162b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#else 163b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohetstatic __inline__ Uint64 SDL_Swap64(Uint64 x) 164b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet{ 165b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet Uint32 hi, lo; 166b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet 167b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet /* Separate into high and low 32-bit values and swap them */ 1684458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF); 169b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet x >>= 32; 1704458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF); 171b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet x = SDL_Swap32(lo); 172b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet x <<= 32; 173b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet x |= SDL_Swap32(hi); 1744458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall return (x); 175b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet} 176b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#endif 177b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#else 178b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet/* This is mainly to keep compilers from complaining in SDL code. 1794458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall * If there is no real 64-bit datatype, then compilers will complain about 1804458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall * the fake 64-bit datatype that SDL provides when it compiles user code. 1814458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall */ 182b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#define SDL_Swap64(X) (X) 183b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#endif /* SDL_HAS_64BIT_TYPE */ 1844458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall/*@}*/ 185b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet 1864458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall/** 1874458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall * @name SDL_SwapLE and SDL_SwapBE Functions 1884458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall * Byteswap item from the specified endianness to the native endianness 1894458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall */ 1904458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall/*@{*/ 191b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#if SDL_BYTEORDER == SDL_LIL_ENDIAN 192b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#define SDL_SwapLE16(X) (X) 193b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#define SDL_SwapLE32(X) (X) 194b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#define SDL_SwapLE64(X) (X) 195b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#define SDL_SwapBE16(X) SDL_Swap16(X) 196b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#define SDL_SwapBE32(X) SDL_Swap32(X) 197b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#define SDL_SwapBE64(X) SDL_Swap64(X) 198b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#else 199b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#define SDL_SwapLE16(X) SDL_Swap16(X) 200b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#define SDL_SwapLE32(X) SDL_Swap32(X) 201b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#define SDL_SwapLE64(X) SDL_Swap64(X) 202b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#define SDL_SwapBE16(X) (X) 203b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#define SDL_SwapBE32(X) (X) 204b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#define SDL_SwapBE64(X) (X) 205b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#endif 2064458c4364a99c5d8d124b19eec146b0998c4895aJesse Hall/*@}*/ 207b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet 208b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet/* Ends C function definitions when using C++ */ 209b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#ifdef __cplusplus 210b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet} 211b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#endif 212b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#include "close_code.h" 213b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet 214b565d46b836401fa5dac23f9f8f0841c7a41e58eXavier Ducrohet#endif /* _SDL_endian_h */ 215