mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-09 10:31:14 +00:00
Fix up the Windows portion of Atomic.h. This is untested, but it is my best understanding of what should work.
I'd be much obliged if someone on MSVC++ could try this out and let me know if it works. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72087 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
03462230c7
commit
ecb1684d51
@ -62,11 +62,24 @@ namespace llvm {
|
||||
}
|
||||
#elif defined(_MSC_VER)
|
||||
typedef LONG cas_flag;
|
||||
template<typename T>
|
||||
inline T CompareAndSwap(volatile T* ptr,
|
||||
T new_value,
|
||||
T old_value) {
|
||||
return InterlockedCompareExchange(addr, new_value, old_value);
|
||||
if (sizeof(T) == 4)
|
||||
return InterlockedCompareExchange(ptr, new_value, old_value);
|
||||
else
|
||||
return InterlockedCompareExchange64(ptr, new_value, old_value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T* CompareAndSwap<T*>(volatile T** ptr,
|
||||
T* new_value,
|
||||
T* old_value) {
|
||||
return InterlockedCompareExchangePtr(ptr, new_value, old_value);
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
# error No compare-and-swap implementation for your platform!
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user