aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/atomic.h
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/atomic.h')
-rw-r--r--Alc/atomic.h50
1 files changed, 25 insertions, 25 deletions
diff --git a/Alc/atomic.h b/Alc/atomic.h
index 9c249808..1dd8f9dc 100644
--- a/Alc/atomic.h
+++ b/Alc/atomic.h
@@ -6,31 +6,31 @@ typedef void *volatile XchgPtr;
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && !defined(__QNXNTO__)
typedef unsigned int RefCount;
-static inline RefCount IncrementRef(volatile RefCount *ptr)
+inline RefCount IncrementRef(volatile RefCount *ptr)
{ return __sync_add_and_fetch(ptr, 1); }
-static inline RefCount DecrementRef(volatile RefCount *ptr)
+inline RefCount DecrementRef(volatile RefCount *ptr)
{ return __sync_sub_and_fetch(ptr, 1); }
-static inline int ExchangeInt(volatile int *ptr, int newval)
+inline int ExchangeInt(volatile int *ptr, int newval)
{
return __sync_lock_test_and_set(ptr, newval);
}
-static inline void *ExchangePtr(XchgPtr *ptr, void *newval)
+inline void *ExchangePtr(XchgPtr *ptr, void *newval)
{
return __sync_lock_test_and_set(ptr, newval);
}
-static inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newval)
+inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newval)
{
return __sync_bool_compare_and_swap(ptr, oldval, newval);
}
-static inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval)
+inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval)
{
return __sync_bool_compare_and_swap(ptr, oldval, newval);
}
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
-static inline unsigned int xaddl(volatile unsigned int *dest, int incr)
+inline unsigned int xaddl(volatile unsigned int *dest, int incr)
{
unsigned int ret;
__asm__ __volatile__("lock; xaddl %0,(%1)"
@@ -41,12 +41,12 @@ static inline unsigned int xaddl(volatile unsigned int *dest, int incr)
}
typedef unsigned int RefCount;
-static inline RefCount IncrementRef(volatile RefCount *ptr)
+inline RefCount IncrementRef(volatile RefCount *ptr)
{ return xaddl(ptr, 1)+1; }
-static inline RefCount DecrementRef(volatile RefCount *ptr)
+inline RefCount DecrementRef(volatile RefCount *ptr)
{ return xaddl(ptr, -1)-1; }
-static inline int ExchangeInt(volatile int *dest, int newval)
+inline int ExchangeInt(volatile int *dest, int newval)
{
int ret;
__asm__ __volatile__("lock; xchgl %0,(%1)"
@@ -56,7 +56,7 @@ static inline int ExchangeInt(volatile int *dest, int newval)
return ret;
}
-static inline ALboolean CompExchangeInt(volatile int *dest, int oldval, int newval)
+inline ALboolean CompExchangeInt(volatile int *dest, int oldval, int newval)
{
int ret;
__asm__ __volatile__("lock; cmpxchgl %2,(%1)"
@@ -66,7 +66,7 @@ static inline ALboolean CompExchangeInt(volatile int *dest, int oldval, int newv
return ret == oldval;
}
-static inline void *ExchangePtr(XchgPtr *dest, void *newval)
+inline void *ExchangePtr(XchgPtr *dest, void *newval)
{
void *ret;
__asm__ __volatile__(
@@ -82,7 +82,7 @@ static inline void *ExchangePtr(XchgPtr *dest, void *newval)
return ret;
}
-static inline ALboolean CompExchangePtr(XchgPtr *dest, void *oldval, void *newval)
+inline ALboolean CompExchangePtr(XchgPtr *dest, void *oldval, void *newval)
{
void *ret;
__asm__ __volatile__(
@@ -104,14 +104,14 @@ static inline ALboolean CompExchangePtr(XchgPtr *dest, void *oldval, void *newva
#include <windows.h>
typedef LONG RefCount;
-static inline RefCount IncrementRef(volatile RefCount *ptr)
+inline RefCount IncrementRef(volatile RefCount *ptr)
{ return InterlockedIncrement(ptr); }
-static inline RefCount DecrementRef(volatile RefCount *ptr)
+inline RefCount DecrementRef(volatile RefCount *ptr)
{ return InterlockedDecrement(ptr); }
extern ALbyte LONG_size_does_not_match_int[(sizeof(LONG)==sizeof(int))?1:-1];
-static inline int ExchangeInt(volatile int *ptr, int newval)
+inline int ExchangeInt(volatile int *ptr, int newval)
{
union {
volatile int *i;
@@ -119,11 +119,11 @@ static inline int ExchangeInt(volatile int *ptr, int newval)
} u = { ptr };
return InterlockedExchange(u.l, newval);
}
-static inline void *ExchangePtr(XchgPtr *ptr, void *newval)
+inline void *ExchangePtr(XchgPtr *ptr, void *newval)
{
return InterlockedExchangePointer(ptr, newval);
}
-static inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newval)
+inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newval)
{
union {
volatile int *i;
@@ -131,7 +131,7 @@ static inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newva
} u = { ptr };
return InterlockedCompareExchange(u.l, newval, oldval) == oldval;
}
-static inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval)
+inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval)
{
return InterlockedCompareExchangePointer(ptr, newval, oldval) == oldval;
}
@@ -141,12 +141,12 @@ static inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval
#include <libkern/OSAtomic.h>
typedef int32_t RefCount;
-static inline RefCount IncrementRef(volatile RefCount *ptr)
+inline RefCount IncrementRef(volatile RefCount *ptr)
{ return OSAtomicIncrement32Barrier(ptr); }
-static inline RefCount DecrementRef(volatile RefCount *ptr)
+inline RefCount DecrementRef(volatile RefCount *ptr)
{ return OSAtomicDecrement32Barrier(ptr); }
-static inline int ExchangeInt(volatile int *ptr, int newval)
+inline int ExchangeInt(volatile int *ptr, int newval)
{
/* Really? No regular old atomic swap? */
int oldval;
@@ -155,7 +155,7 @@ static inline int ExchangeInt(volatile int *ptr, int newval)
} while(!OSAtomicCompareAndSwap32Barrier(oldval, newval, ptr));
return oldval;
}
-static inline void *ExchangePtr(XchgPtr *ptr, void *newval)
+inline void *ExchangePtr(XchgPtr *ptr, void *newval)
{
void *oldval;
do {
@@ -163,11 +163,11 @@ static inline void *ExchangePtr(XchgPtr *ptr, void *newval)
} while(!OSAtomicCompareAndSwapPtrBarrier(oldval, newval, ptr));
return oldval;
}
-static inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newval)
+inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newval)
{
return OSAtomicCompareAndSwap32Barrier(oldval, newval, ptr);
}
-static inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval)
+inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval)
{
return OSAtomicCompareAndSwapPtrBarrier(oldval, newval, ptr);
}