| Index: runtime/vm/atomic_win.h
|
| diff --git a/runtime/vm/atomic_win.h b/runtime/vm/atomic_win.h
|
| index 7abf59e44a8fb88a4d3a38f42f13da8581921eba..398ed439d31eb86ca4201cc3df86cbfd138bd8ba 100644
|
| --- a/runtime/vm/atomic_win.h
|
| +++ b/runtime/vm/atomic_win.h
|
| @@ -18,10 +18,12 @@ namespace dart {
|
| inline uintptr_t AtomicOperations::FetchAndIncrement(uintptr_t* p) {
|
| #if defined(HOST_ARCH_X64)
|
| return static_cast<uintptr_t>(
|
| - InterlockedIncrement64(reinterpret_cast<LONGLONG*>(p))) - 1;
|
| + InterlockedIncrement64(reinterpret_cast<LONGLONG*>(p))) -
|
| + 1;
|
| #elif defined(HOST_ARCH_IA32)
|
| return static_cast<uintptr_t>(
|
| - InterlockedIncrement(reinterpret_cast<LONG*>(p))) - 1;
|
| + InterlockedIncrement(reinterpret_cast<LONG*>(p))) -
|
| + 1;
|
| #else
|
| #error Unsupported host architecture.
|
| #endif
|
| @@ -31,10 +33,12 @@ inline uintptr_t AtomicOperations::FetchAndIncrement(uintptr_t* p) {
|
| inline intptr_t AtomicOperations::FetchAndIncrement(intptr_t* p) {
|
| #if defined(HOST_ARCH_X64)
|
| return static_cast<intptr_t>(
|
| - InterlockedIncrement64(reinterpret_cast<LONGLONG*>(p))) - 1;
|
| + InterlockedIncrement64(reinterpret_cast<LONGLONG*>(p))) -
|
| + 1;
|
| #elif defined(HOST_ARCH_IA32)
|
| return static_cast<intptr_t>(
|
| - InterlockedIncrement(reinterpret_cast<LONG*>(p))) - 1;
|
| + InterlockedIncrement(reinterpret_cast<LONG*>(p))) -
|
| + 1;
|
| #else
|
| #error Unsupported host architecture.
|
| #endif
|
| @@ -46,8 +50,7 @@ inline void AtomicOperations::IncrementBy(intptr_t* p, intptr_t value) {
|
| InterlockedExchangeAdd64(reinterpret_cast<LONGLONG*>(p),
|
| static_cast<LONGLONG>(value));
|
| #elif defined(HOST_ARCH_IA32)
|
| - InterlockedExchangeAdd(reinterpret_cast<LONG*>(p),
|
| - static_cast<LONG>(value));
|
| + InterlockedExchangeAdd(reinterpret_cast<LONG*>(p), static_cast<LONG>(value));
|
| #else
|
| #error Unsupported host architecture.
|
| #endif
|
| @@ -67,10 +70,12 @@ inline void AtomicOperations::IncrementInt64By(int64_t* p, int64_t value) {
|
| inline uintptr_t AtomicOperations::FetchAndDecrement(uintptr_t* p) {
|
| #if defined(HOST_ARCH_X64)
|
| return static_cast<uintptr_t>(
|
| - InterlockedDecrement64(reinterpret_cast<LONGLONG*>(p))) + 1;
|
| + InterlockedDecrement64(reinterpret_cast<LONGLONG*>(p))) +
|
| + 1;
|
| #elif defined(HOST_ARCH_IA32)
|
| return static_cast<uintptr_t>(
|
| - InterlockedDecrement(reinterpret_cast<LONG*>(p))) + 1;
|
| + InterlockedDecrement(reinterpret_cast<LONG*>(p))) +
|
| + 1;
|
| #else
|
| #error Unsupported host architecture.
|
| #endif
|
| @@ -80,10 +85,12 @@ inline uintptr_t AtomicOperations::FetchAndDecrement(uintptr_t* p) {
|
| inline intptr_t AtomicOperations::FetchAndDecrement(intptr_t* p) {
|
| #if defined(HOST_ARCH_X64)
|
| return static_cast<intptr_t>(
|
| - InterlockedDecrement64(reinterpret_cast<LONGLONG*>(p))) + 1;
|
| + InterlockedDecrement64(reinterpret_cast<LONGLONG*>(p))) +
|
| + 1;
|
| #elif defined(HOST_ARCH_IA32)
|
| return static_cast<intptr_t>(
|
| - InterlockedDecrement(reinterpret_cast<LONG*>(p))) + 1;
|
| + InterlockedDecrement(reinterpret_cast<LONG*>(p))) +
|
| + 1;
|
| #else
|
| #error Unsupported host architecture.
|
| #endif
|
| @@ -95,8 +102,7 @@ inline void AtomicOperations::DecrementBy(intptr_t* p, intptr_t value) {
|
| InterlockedExchangeAdd64(reinterpret_cast<LONGLONG*>(p),
|
| static_cast<LONGLONG>(-value));
|
| #elif defined(HOST_ARCH_IA32)
|
| - InterlockedExchangeAdd(reinterpret_cast<LONG*>(p),
|
| - static_cast<LONG>(-value));
|
| + InterlockedExchangeAdd(reinterpret_cast<LONG*>(p), static_cast<LONG>(-value));
|
| #else
|
| #error Unsupported host architecture.
|
| #endif
|
| @@ -108,15 +114,13 @@ inline uword AtomicOperations::CompareAndSwapWord(uword* ptr,
|
| uword old_value,
|
| uword new_value) {
|
| #if defined(HOST_ARCH_X64)
|
| - return static_cast<uword>(
|
| - InterlockedCompareExchange64(reinterpret_cast<LONGLONG*>(ptr),
|
| - static_cast<LONGLONG>(new_value),
|
| - static_cast<LONGLONG>(old_value)));
|
| + return static_cast<uword>(InterlockedCompareExchange64(
|
| + reinterpret_cast<LONGLONG*>(ptr), static_cast<LONGLONG>(new_value),
|
| + static_cast<LONGLONG>(old_value)));
|
| #elif defined(HOST_ARCH_IA32)
|
| - return static_cast<uword>(
|
| - InterlockedCompareExchange(reinterpret_cast<LONG*>(ptr),
|
| - static_cast<LONG>(new_value),
|
| - static_cast<LONG>(old_value)));
|
| + return static_cast<uword>(InterlockedCompareExchange(
|
| + reinterpret_cast<LONG*>(ptr), static_cast<LONG>(new_value),
|
| + static_cast<LONG>(old_value)));
|
| #else
|
| #error Unsupported host architecture.
|
| #endif
|
| @@ -125,10 +129,9 @@ inline uint32_t AtomicOperations::CompareAndSwapUint32(uint32_t* ptr,
|
| uint32_t old_value,
|
| uint32_t new_value) {
|
| #if (defined(HOST_ARCH_X64) || defined(HOST_ARCH_IA32))
|
| - return static_cast<uint32_t>(
|
| - InterlockedCompareExchange(reinterpret_cast<LONG*>(ptr),
|
| - static_cast<LONG>(new_value),
|
| - static_cast<LONG>(old_value)));
|
| + return static_cast<uint32_t>(InterlockedCompareExchange(
|
| + reinterpret_cast<LONG*>(ptr), static_cast<LONG>(new_value),
|
| + static_cast<LONG>(old_value)));
|
| #else
|
| #error Unsupported host architecture.
|
| #endif
|
|
|