diff options
Diffstat (limited to 'src/common/src/atomic_gcc.h')
-rw-r--r-- | src/common/src/atomic_gcc.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/common/src/atomic_gcc.h b/src/common/src/atomic_gcc.h index 0f820f4f..2eb38697 100644 --- a/src/common/src/atomic_gcc.h +++ b/src/common/src/atomic_gcc.h @@ -25,42 +25,42 @@ namespace Common { inline void AtomicAdd(volatile u32& target, u32 value) { - __sync_add_and_fetch(&target, value); + __sync_add_and_fetch(&target, value); } inline void AtomicAnd(volatile u32& target, u32 value) { - __sync_and_and_fetch(&target, value); + __sync_and_and_fetch(&target, value); } inline void AtomicDecrement(volatile u32& target) { - __sync_add_and_fetch(&target, -1); + __sync_add_and_fetch(&target, -1); } inline void AtomicIncrement(volatile u32& target) { - __sync_add_and_fetch(&target, 1); + __sync_add_and_fetch(&target, 1); } inline u32 AtomicLoad(volatile u32& src) { - return src; // 32-bit reads are always atomic. + return src; // 32-bit reads are always atomic. } inline u32 AtomicLoadAcquire(volatile u32& src) { - //keep the compiler from caching any memory references - u32 result = src; // 32-bit reads are always atomic. - //__sync_synchronize(); // TODO: May not be necessary. - // Compiler instruction only. x86 loads always have acquire semantics. - __asm__ __volatile__ ( "":::"memory" ); - return result; + //keep the compiler from caching any memory references + u32 result = src; // 32-bit reads are always atomic. + //__sync_synchronize(); // TODO: May not be necessary. + // Compiler instruction only. x86 loads always have acquire semantics. + __asm__ __volatile__ ( "":::"memory" ); + return result; } inline void AtomicOr(volatile u32& target, u32 value) { - __sync_or_and_fetch(&target, value); + __sync_or_and_fetch(&target, value); } inline void AtomicStore(volatile u32& dest, u32 value) { - dest = value; // 32-bit writes are always atomic. + dest = value; // 32-bit writes are always atomic. } inline void AtomicStoreRelease(volatile u32& dest, u32 value) { - __sync_lock_test_and_set(&dest, value); // TODO: Wrong! This function is has acquire semantics. + __sync_lock_test_and_set(&dest, value); // TODO: Wrong! This function is has acquire semantics. } } |