diff options
author | sebmarchand@chromium.org <sebmarchand@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-12 16:17:26 +0000 |
---|---|---|
committer | sebmarchand@chromium.org <sebmarchand@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-12 16:17:26 +0000 |
commit | 17f8b99be153485eb252377ea822791fe3955f5f (patch) | |
tree | b4c399e44e1ebee7df51d8930dcf7780e0288318 /base/atomicops_internals_x86_msvc.h | |
parent | f1fb414402ac6077d6d424f1eddfca69bb7fc00a (diff) | |
download | chromium_src-17f8b99be153485eb252377ea822791fe3955f5f.zip chromium_src-17f8b99be153485eb252377ea822791fe3955f5f.tar.gz chromium_src-17f8b99be153485eb252377ea822791fe3955f5f.tar.bz2 |
Use the intrinsic version of the Interlocked* functions.
This save us a system call and allows this code to be instrumented by the memory testing tools.
BUG=
Review URL: https://codereview.chromium.org/308683011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276701 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/atomicops_internals_x86_msvc.h')
-rw-r--r-- | base/atomicops_internals_x86_msvc.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/base/atomicops_internals_x86_msvc.h b/base/atomicops_internals_x86_msvc.h index 016744c..0269d89 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) @@ -26,7 +28,7 @@ namespace subtle { 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 +37,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 +45,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; } |