Chromium Code Reviews| Index: native_client_sdk/src/libraries/sdk_util/atomicops.h |
| diff --git a/native_client_sdk/src/libraries/sdk_util/atomicops.h b/native_client_sdk/src/libraries/sdk_util/atomicops.h |
| index 80d62d215712b05bfa5b9c141d25c4baf46674ce..8f993ce3fd43ce27635f4ff9033576e1e56c8f4d 100644 |
| --- a/native_client_sdk/src/libraries/sdk_util/atomicops.h |
| +++ b/native_client_sdk/src/libraries/sdk_util/atomicops.h |
| @@ -21,6 +21,18 @@ inline Atomic32 AtomicAddFetch(volatile Atomic32* ptr, Atomic32 value) { |
| return __sync_add_and_fetch(ptr, value); |
| } |
| +inline Atomic32 AtomicAndFetch(volatile Atomic32* ptr, Atomic32 value) { |
|
binji
2013/07/12 00:51:23
these are not used, maybe add them in a CL that us
noelallen1
2013/07/12 23:18:47
I though it made more sense to break them out with
|
| + return __sync_and_and_fetch(ptr, value); |
| +} |
| + |
| +inline Atomic32 AtomicOrFetch(volatile Atomic32* ptr, Atomic32 value) { |
| + return __sync_or_and_fetch(ptr, value); |
| +} |
| + |
| +inline Atomic32 AtomicXorFetch(volatile Atomic32* ptr, Atomic32 value) { |
| + return __sync_xor_and_fetch(ptr, value); |
| +} |
| + |
| #else |
| #include <windows.h> |
| @@ -38,6 +50,19 @@ typedef long Atomic32; |
| inline Atomic32 AtomicAddFetch(volatile Atomic32* ptr, Atomic32 value) { |
| return InterlockedExchangeAdd(ptr, value); |
| } |
| + |
| +inline Atomic32 AtomicAndFetch(volatile Atomic32* ptr, Atomic32 value) { |
| + return InterlockedAnd(ptr, value); |
| +} |
| + |
| +inline Atomic32 AtomicOrFetch(volatile Atomic32* ptr, Atomic32 value) { |
| + return InterlockedOr(ptr, value); |
| +} |
| + |
| +inline Atomic32 AtomicXorFetch(volatile Atomic32* ptr, Atomic32 value) { |
| + return InterlockedOr(ptr, value); |
| +} |
| + |
| #endif |