23 #if defined(i386) || defined(__i386) || defined(__i386__) 24 #define ATOMICS_USE_XADD 28 #ifdef ATOMICS_USE_XADD 30 unsigned int xadd_4(
volatile void* pVal,
unsigned int inc)
33 unsigned int* pValInt = (
unsigned int*)pVal;
36 "lock; xaddl %%eax, %2;" 38 :
"a" (inc),
"m" (*pValInt)
48 unsigned int result = xadd_4(pInt, 1) + 1;
55 unsigned int result = xadd_4(pInt, -1) - 1;
65 return __sync_add_and_fetch(pInt, 1);
71 return __sync_sub_and_fetch(pInt, 1);
int AtomicIncrement(int *pInt)
#define COMPILE_TIME_ASSERT(x)
int AtomicDecrement(int *pInt)