Don't put 64-bit OS X code in the 32-bit-only file. Do put it in the 64-bit-only file.

This was SVN commit r8687.
This commit is contained in:
Ykkrosh 2010-11-24 17:08:00 +00:00
parent 8fe513aba5
commit 404f7d4caa
2 changed files with 21 additions and 8 deletions

View File

@ -60,6 +60,27 @@ intptr_t cpu_AtomicAdd(volatile intptr_t* location, intptr_t increment)
return _InterlockedExchangeAdd64((P64)location, increment);
}
#elif OS_MACOSX
#include <libkern/OSAtomic.h>
intptr_t cpu_AtomicAdd(volatile intptr_t* location, intptr_t increment)
{
cassert(sizeof(intptr_t) == sizeof(int64_t));
return OSAtomicAdd64Barrier(increment, (volatile int64_t*)location);
}
bool cpu_CAS(volatile intptr_t* location, intptr_t expected, intptr_t newValue)
{
cassert(sizeof(intptr_t) == sizeof(void*));
return OSAtomicCompareAndSwapPtrBarrier((void*)expected, (void*)newValue, (void* volatile*)location);
}
bool cpu_CAS64(volatile i64* location, i64 expected, i64 newValue)
{
return OSAtomicCompareAndSwap64Barrier(expected, newValue, location);
}
#elif GCC_VERSION
intptr_t cpu_AtomicAdd(volatile intptr_t* location, intptr_t increment)

View File

@ -178,19 +178,11 @@ intptr_t cpu_AtomicAdd(volatile intptr_t* location, intptr_t increment)
#include <libkern/OSAtomic.h>
#if ARCH_IA32
intptr_t cpu_AtomicAdd(volatile intptr_t* location, intptr_t increment)
{
cassert(sizeof(intptr_t) == sizeof(int32_t));
return OSAtomicAdd32Barrier(increment, (volatile int32_t*)location);
}
#else
intptr_t cpu_AtomicAdd(volatile intptr_t* location, intptr_t increment)
{
cassert(sizeof(intptr_t) == sizeof(int64_t));
return OSAtomicAdd64Barrier(increment, (volatile int64_t*)location);
}
#endif
bool cpu_CAS(volatile intptr_t* location, intptr_t expected, intptr_t newValue)
{