Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Unified Diff: runtime/vm/atomic_win.h

Issue 1644393003: Use InterlockedExchangeAdd varient instead of InterlockedAdd which doesn't seem to be available on … (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix-usage Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/atomic_win.h
diff --git a/runtime/vm/atomic_win.h b/runtime/vm/atomic_win.h
index 410c1a2bf1986a7e7d5a3c11f485607266501ff2..2ade768e2f19e33f86afc840fb2b239500a4a82f 100644
--- a/runtime/vm/atomic_win.h
+++ b/runtime/vm/atomic_win.h
@@ -32,12 +32,12 @@ inline uintptr_t AtomicOperations::FetchAndIncrementBy(intptr_t* p,
intptr_t value) {
#if defined(HOST_ARCH_X64)
return static_cast<uintptr_t>(
- InterlockedAdd64(reinterpret_cast<LONGLONG*>(p),
- static_cast<LONGLONG>(value))) - value;
+ InterlockedExchangeAdd64(reinterpret_cast<LONGLONG*>(p),
+ static_cast<LONGLONG>(value)));
#elif defined(HOST_ARCH_IA32)
return static_cast<uintptr_t>(
- InterlockedAdd(reinterpret_cast<LONG*>(p),
- static_cast<LONG>(value))) - value;
+ InterlockedExchangeAdd(reinterpret_cast<LONG*>(p),
+ static_cast<LONG>(value)));
#else
#error Unsupported host architecture.
#endif
@@ -61,12 +61,12 @@ inline uintptr_t AtomicOperations::FetchAndDecrementBy(intptr_t* p,
intptr_t value) {
#if defined(HOST_ARCH_X64)
return static_cast<uintptr_t>(
- InterlockedAdd64(reinterpret_cast<LONGLONG*>(p),
- static_cast<LONGLONG>(-value))) + value;
+ InterlockedExchangeAdd64(reinterpret_cast<LONGLONG*>(p),
+ static_cast<LONGLONG>(-value)));
#elif defined(HOST_ARCH_IA32)
return static_cast<uintptr_t>(
- InterlockedAdd(reinterpret_cast<LONG*>(p),
- static_cast<LONG>(-value))) + value;
+ InterlockedExchangeAdd(reinterpret_cast<LONG*>(p),
+ static_cast<LONG>(-value)));
#else
#error Unsupported host architecture.
#endif
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698