mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-08 19:25:47 +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:
@@ -62,11 +62,24 @@ namespace llvm {
|
|||||||
}
|
}
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
typedef LONG cas_flag;
|
typedef LONG cas_flag;
|
||||||
|
template<typename T>
|
||||||
inline T CompareAndSwap(volatile T* ptr,
|
inline T CompareAndSwap(volatile T* ptr,
|
||||||
T new_value,
|
T new_value,
|
||||||
T old_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
|
#else
|
||||||
# error No compare-and-swap implementation for your platform!
|
# error No compare-and-swap implementation for your platform!
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user