Replace all the "static __inline__" functions with SDL_FORCE_INLINE.

This commit is contained in:
Ryan C. Gordon 2013-03-15 01:09:19 -04:00
parent 7e934f8f75
commit a26645f7b1
3 changed files with 20 additions and 30 deletions

View file

@ -66,29 +66,24 @@ extern "C" {
/**
* \file SDL_endian.h
*
* Uses inline functions for compilers that support them, and static
* functions for those that do not. Because these functions become
* static for compilers that do not support inline functions, this
* header should only be included in files that actually use them.
*/
#if defined(__GNUC__) && defined(__i386__) && \
!(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */)
static __inline__ Uint16
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
__asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
return x;
}
#elif defined(__GNUC__) && defined(__x86_64__)
static __inline__ Uint16
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
__asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
return x;
}
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
static __inline__ Uint16
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
int result;
@ -97,14 +92,14 @@ SDL_Swap16(Uint16 x)
return (Uint16)result;
}
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
static __inline__ Uint16
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
__asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
return x;
}
#else
static __inline__ Uint16
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
@ -112,21 +107,21 @@ SDL_Swap16(Uint16 x)
#endif
#if defined(__GNUC__) && defined(__i386__)
static __inline__ Uint32
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
__asm__("bswap %0": "=r"(x):"0"(x));
return x;
}
#elif defined(__GNUC__) && defined(__x86_64__)
static __inline__ Uint32
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
__asm__("bswapl %0": "=r"(x):"0"(x));
return x;
}
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
static __inline__ Uint32
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
Uint32 result;
@ -137,14 +132,14 @@ SDL_Swap32(Uint32 x)
return result;
}
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
static __inline__ Uint32
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
return x;
}
#else
static __inline__ Uint32
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
@ -153,7 +148,7 @@ SDL_Swap32(Uint32 x)
#endif
#if defined(__GNUC__) && defined(__i386__)
static __inline__ Uint64
SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x)
{
union
@ -171,14 +166,14 @@ SDL_Swap64(Uint64 x)
return v.u;
}
#elif defined(__GNUC__) && defined(__x86_64__)
static __inline__ Uint64
SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x)
{
__asm__("bswapq %0": "=r"(x):"0"(x));
return x;
}
#else
static __inline__ Uint64
SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x)
{
Uint32 hi, lo;
@ -195,7 +190,7 @@ SDL_Swap64(Uint64 x)
#endif
static __inline__ float
SDL_FORCE_INLINE float
SDL_SwapFloat(float x)
{
union