Replace all the "static __inline__" functions with SDL_FORCE_INLINE.
This commit is contained in:
parent
7e934f8f75
commit
a26645f7b1
3 changed files with 20 additions and 30 deletions
|
@ -205,7 +205,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int
|
||||||
* \return The previous value of the atomic variable.
|
* \return The previous value of the atomic variable.
|
||||||
*/
|
*/
|
||||||
#ifndef SDL_AtomicSet
|
#ifndef SDL_AtomicSet
|
||||||
static __inline__ int SDL_AtomicSet(SDL_atomic_t *a, int v)
|
SDL_FORCE_INLINE int SDL_AtomicSet(SDL_atomic_t *a, int v)
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
do {
|
do {
|
||||||
|
@ -219,7 +219,7 @@ static __inline__ int SDL_AtomicSet(SDL_atomic_t *a, int v)
|
||||||
* \brief Get the value of an atomic variable
|
* \brief Get the value of an atomic variable
|
||||||
*/
|
*/
|
||||||
#ifndef SDL_AtomicGet
|
#ifndef SDL_AtomicGet
|
||||||
static __inline__ int SDL_AtomicGet(SDL_atomic_t *a)
|
SDL_FORCE_INLINE int SDL_AtomicGet(SDL_atomic_t *a)
|
||||||
{
|
{
|
||||||
int value = a->value;
|
int value = a->value;
|
||||||
SDL_CompilerBarrier();
|
SDL_CompilerBarrier();
|
||||||
|
@ -235,7 +235,7 @@ static __inline__ int SDL_AtomicGet(SDL_atomic_t *a)
|
||||||
* \note This same style can be used for any number operation
|
* \note This same style can be used for any number operation
|
||||||
*/
|
*/
|
||||||
#ifndef SDL_AtomicAdd
|
#ifndef SDL_AtomicAdd
|
||||||
static __inline__ int SDL_AtomicAdd(SDL_atomic_t *a, int v)
|
SDL_FORCE_INLINE int SDL_AtomicAdd(SDL_atomic_t *a, int v)
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
do {
|
do {
|
||||||
|
@ -279,7 +279,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void* *a, void *oldval, void *
|
||||||
* \return The previous value of the pointer.
|
* \return The previous value of the pointer.
|
||||||
*/
|
*/
|
||||||
#ifndef SDL_AtomicSetPtr
|
#ifndef SDL_AtomicSetPtr
|
||||||
static __inline__ void* SDL_AtomicSetPtr(void* *a, void* v)
|
SDL_FORCE_INLINE void* SDL_AtomicSetPtr(void* *a, void* v)
|
||||||
{
|
{
|
||||||
void* value;
|
void* value;
|
||||||
do {
|
do {
|
||||||
|
@ -293,7 +293,7 @@ static __inline__ void* SDL_AtomicSetPtr(void* *a, void* v)
|
||||||
* \brief Get the value of a pointer atomically.
|
* \brief Get the value of a pointer atomically.
|
||||||
*/
|
*/
|
||||||
#ifndef SDL_AtomicGetPtr
|
#ifndef SDL_AtomicGetPtr
|
||||||
static __inline__ void* SDL_AtomicGetPtr(void* *a)
|
SDL_FORCE_INLINE void* SDL_AtomicGetPtr(void* *a)
|
||||||
{
|
{
|
||||||
void* value = *a;
|
void* value = *a;
|
||||||
SDL_CompilerBarrier();
|
SDL_CompilerBarrier();
|
||||||
|
|
|
@ -40,11 +40,6 @@ extern "C" {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file SDL_bits.h
|
* \file SDL_bits.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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,7 +49,7 @@ extern "C" {
|
||||||
*
|
*
|
||||||
* \return Index of the most significant bit.
|
* \return Index of the most significant bit.
|
||||||
*/
|
*/
|
||||||
static __inline__ Sint8
|
SDL_FORCE_INLINE Sint8
|
||||||
SDL_MostSignificantBitIndex32(Uint32 x)
|
SDL_MostSignificantBitIndex32(Uint32 x)
|
||||||
{
|
{
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
|
|
|
@ -66,29 +66,24 @@ extern "C" {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file SDL_endian.h
|
* \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__) && \
|
#if defined(__GNUC__) && defined(__i386__) && \
|
||||||
!(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */)
|
!(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */)
|
||||||
static __inline__ Uint16
|
SDL_FORCE_INLINE Uint16
|
||||||
SDL_Swap16(Uint16 x)
|
SDL_Swap16(Uint16 x)
|
||||||
{
|
{
|
||||||
__asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
|
__asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||||
static __inline__ Uint16
|
SDL_FORCE_INLINE Uint16
|
||||||
SDL_Swap16(Uint16 x)
|
SDL_Swap16(Uint16 x)
|
||||||
{
|
{
|
||||||
__asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
|
__asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
||||||
static __inline__ Uint16
|
SDL_FORCE_INLINE Uint16
|
||||||
SDL_Swap16(Uint16 x)
|
SDL_Swap16(Uint16 x)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
@ -97,14 +92,14 @@ SDL_Swap16(Uint16 x)
|
||||||
return (Uint16)result;
|
return (Uint16)result;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
|
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
|
||||||
static __inline__ Uint16
|
SDL_FORCE_INLINE Uint16
|
||||||
SDL_Swap16(Uint16 x)
|
SDL_Swap16(Uint16 x)
|
||||||
{
|
{
|
||||||
__asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
|
__asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static __inline__ Uint16
|
SDL_FORCE_INLINE Uint16
|
||||||
SDL_Swap16(Uint16 x)
|
SDL_Swap16(Uint16 x)
|
||||||
{
|
{
|
||||||
return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
|
return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
|
||||||
|
@ -112,21 +107,21 @@ SDL_Swap16(Uint16 x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(__i386__)
|
#if defined(__GNUC__) && defined(__i386__)
|
||||||
static __inline__ Uint32
|
SDL_FORCE_INLINE Uint32
|
||||||
SDL_Swap32(Uint32 x)
|
SDL_Swap32(Uint32 x)
|
||||||
{
|
{
|
||||||
__asm__("bswap %0": "=r"(x):"0"(x));
|
__asm__("bswap %0": "=r"(x):"0"(x));
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||||
static __inline__ Uint32
|
SDL_FORCE_INLINE Uint32
|
||||||
SDL_Swap32(Uint32 x)
|
SDL_Swap32(Uint32 x)
|
||||||
{
|
{
|
||||||
__asm__("bswapl %0": "=r"(x):"0"(x));
|
__asm__("bswapl %0": "=r"(x):"0"(x));
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
|
||||||
static __inline__ Uint32
|
SDL_FORCE_INLINE Uint32
|
||||||
SDL_Swap32(Uint32 x)
|
SDL_Swap32(Uint32 x)
|
||||||
{
|
{
|
||||||
Uint32 result;
|
Uint32 result;
|
||||||
|
@ -137,14 +132,14 @@ SDL_Swap32(Uint32 x)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
|
#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
|
||||||
static __inline__ Uint32
|
SDL_FORCE_INLINE Uint32
|
||||||
SDL_Swap32(Uint32 x)
|
SDL_Swap32(Uint32 x)
|
||||||
{
|
{
|
||||||
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
|
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static __inline__ Uint32
|
SDL_FORCE_INLINE Uint32
|
||||||
SDL_Swap32(Uint32 x)
|
SDL_Swap32(Uint32 x)
|
||||||
{
|
{
|
||||||
return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
|
return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
|
||||||
|
@ -153,7 +148,7 @@ SDL_Swap32(Uint32 x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(__i386__)
|
#if defined(__GNUC__) && defined(__i386__)
|
||||||
static __inline__ Uint64
|
SDL_FORCE_INLINE Uint64
|
||||||
SDL_Swap64(Uint64 x)
|
SDL_Swap64(Uint64 x)
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
|
@ -171,14 +166,14 @@ SDL_Swap64(Uint64 x)
|
||||||
return v.u;
|
return v.u;
|
||||||
}
|
}
|
||||||
#elif defined(__GNUC__) && defined(__x86_64__)
|
#elif defined(__GNUC__) && defined(__x86_64__)
|
||||||
static __inline__ Uint64
|
SDL_FORCE_INLINE Uint64
|
||||||
SDL_Swap64(Uint64 x)
|
SDL_Swap64(Uint64 x)
|
||||||
{
|
{
|
||||||
__asm__("bswapq %0": "=r"(x):"0"(x));
|
__asm__("bswapq %0": "=r"(x):"0"(x));
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static __inline__ Uint64
|
SDL_FORCE_INLINE Uint64
|
||||||
SDL_Swap64(Uint64 x)
|
SDL_Swap64(Uint64 x)
|
||||||
{
|
{
|
||||||
Uint32 hi, lo;
|
Uint32 hi, lo;
|
||||||
|
@ -195,7 +190,7 @@ SDL_Swap64(Uint64 x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static __inline__ float
|
SDL_FORCE_INLINE float
|
||||||
SDL_SwapFloat(float x)
|
SDL_SwapFloat(float x)
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue