Chromium Code Reviews| Index: base/atomicops_internals_x86_msvc.h |
| diff --git a/base/atomicops_internals_x86_msvc.h b/base/atomicops_internals_x86_msvc.h |
| index 016744c144416f869606881e87ee7d8072f75cdd..284c4a3e46376a1c11b1a321850d9cea2825ab89 100644 |
| --- a/base/atomicops_internals_x86_msvc.h |
| +++ b/base/atomicops_internals_x86_msvc.h |
| @@ -9,6 +9,8 @@ |
| #include <windows.h> |
| +#include <intrin.h> |
| + |
| #include "base/macros.h" |
| #if defined(ARCH_CPU_64_BITS) |
| @@ -23,10 +25,16 @@ |
| namespace base { |
| namespace subtle { |
| +// The Interlocked* functions doesn't resolve to their intrinsics |
|
Sigurður Ásgeirsson
2014/06/05 17:41:09
nit: doesn't ->don't
Also mention this is on ia32
|
| +// counterpart, we need to explicitly call the _Interlocked* variant. |
| +#pragma intrinsic(_InterlockedCompareExchange) |
|
Sigurður Ásgeirsson
2014/06/04 15:12:54
do you need even this? Doesn't <intrin.h> declare
Sébastien Marchand
2014/06/04 15:21:02
Nop, it seems that I've to explicitly use the intr
Sigurður Ásgeirsson
2014/06/05 17:41:09
Ah, interesting. Turns out <intrin.h> gives you de
|
| +#pragma intrinsic(_InterlockedExchange) |
| +#pragma intrinsic(_InterlockedExchangeAdd) |
| + |
| inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, |
| Atomic32 old_value, |
| Atomic32 new_value) { |
| - LONG result = InterlockedCompareExchange( |
| + LONG result = _InterlockedCompareExchange( |
| reinterpret_cast<volatile LONG*>(ptr), |
| static_cast<LONG>(new_value), |
| static_cast<LONG>(old_value)); |
| @@ -35,7 +43,7 @@ inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, |
| inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, |
| Atomic32 new_value) { |
| - LONG result = InterlockedExchange( |
| + LONG result = _InterlockedExchange( |
| reinterpret_cast<volatile LONG*>(ptr), |
| static_cast<LONG>(new_value)); |
| return static_cast<Atomic32>(result); |
| @@ -43,7 +51,7 @@ inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, |
| inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, |
| Atomic32 increment) { |
| - return InterlockedExchangeAdd( |
| + return _InterlockedExchangeAdd( |
| reinterpret_cast<volatile LONG*>(ptr), |
| static_cast<LONG>(increment)) + increment; |
| } |