include/SDL_endian.h
changeset 1984 b910bcabec26
parent 1895 c121d94672cb
child 1985 8055185ae4ed
     1.1 --- a/include/SDL_endian.h	Thu Aug 24 12:48:16 2006 +0000
     1.2 +++ b/include/SDL_endian.h	Thu Aug 24 12:49:59 2006 +0000
     1.3 @@ -192,21 +192,35 @@
     1.4  #endif /* SDL_HAS_64BIT_TYPE */
     1.5  
     1.6  
     1.7 +static __inline__ float
     1.8 +SDL_SwapFloat(float x)
     1.9 +{
    1.10 +    union { float f; Uint32 ui32; } swapper;
    1.11 +    swapper.f = x;
    1.12 +    swapper.ui32 = SDL_Swap32(swapper.ui32);
    1.13 +    return swapper.f;
    1.14 +}
    1.15 +
    1.16 +
    1.17  /* Byteswap item from the specified endianness to the native endianness */
    1.18  #if SDL_BYTEORDER == SDL_LIL_ENDIAN
    1.19  #define SDL_SwapLE16(X)	(X)
    1.20  #define SDL_SwapLE32(X)	(X)
    1.21  #define SDL_SwapLE64(X)	(X)
    1.22 +#define SDL_SwapFloatLE(X)	(X)
    1.23  #define SDL_SwapBE16(X)	SDL_Swap16(X)
    1.24  #define SDL_SwapBE32(X)	SDL_Swap32(X)
    1.25  #define SDL_SwapBE64(X)	SDL_Swap64(X)
    1.26 +#define SDL_SwapFloatBE(X)	SDL_SwapFloat(X)
    1.27  #else
    1.28  #define SDL_SwapLE16(X)	SDL_Swap16(X)
    1.29  #define SDL_SwapLE32(X)	SDL_Swap32(X)
    1.30  #define SDL_SwapLE64(X)	SDL_Swap64(X)
    1.31 +#define SDL_SwapFloatLE(X)	SDL_SwapFloat(X)
    1.32  #define SDL_SwapBE16(X)	(X)
    1.33  #define SDL_SwapBE32(X)	(X)
    1.34  #define SDL_SwapBE64(X)	(X)
    1.35 +#define SDL_SwapFloatBE(X)	(X)
    1.36  #endif
    1.37  
    1.38  /* Ends C function definitions when using C++ */