diff options
-rw-r--r-- | include/llvm/System/Atomic.h | 4 | ||||
-rw-r--r-- | lib/System/Atomic.cpp | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/include/llvm/System/Atomic.h b/include/llvm/System/Atomic.h index 0c05d696e3..fc19369d11 100644 --- a/include/llvm/System/Atomic.h +++ b/include/llvm/System/Atomic.h @@ -20,7 +20,11 @@ namespace llvm { namespace sys { void MemoryFence(); +#ifdef _MSC_VER + typedef long cas_flag; +#else typedef uint32_t cas_flag; +#endif cas_flag CompareAndSwap(volatile cas_flag* ptr, cas_flag new_value, cas_flag old_value); diff --git a/lib/System/Atomic.cpp b/lib/System/Atomic.cpp index f9b55a186d..7ba8b774d5 100644 --- a/lib/System/Atomic.cpp +++ b/lib/System/Atomic.cpp @@ -85,7 +85,7 @@ sys::cas_flag sys::AtomicAdd(volatile sys::cas_flag* ptr, sys::cas_flag val) { #elif defined(__GNUC__) return __sync_add_and_fetch(ptr, val); #elif defined(_MSC_VER) - return InterlockedAdd(ptr, val); + return InterlockedExchangeAdd(ptr, val) + val; #else # error No atomic add implementation for your platform! #endif |