diff options
author | Pixel <pixel@nobis-crew.org> | 2011-11-19 11:05:00 -0800 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2011-11-19 11:10:21 -0800 |
commit | 861a79f0207a8391fa37b30427d36cf46c41cbd4 (patch) | |
tree | 56865bb65e8bc8344c0c234a6b20368b4c459d72 /includes | |
parent | 0f0db0ee56b69d580fe66528a379fb08d714bf4d (diff) |
Fixing a few very stupid bugs.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/Atomic.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/includes/Atomic.h b/includes/Atomic.h index d079967..b31c26d 100644 --- a/includes/Atomic.h +++ b/includes/Atomic.h @@ -6,20 +6,20 @@ namespace Atomic { #if (__GNUC__ >= 5) || ((__GNUC__ == 4) && ((__GNUC_MINOR__ >= 1))) // gcc version of the atomic operations -template <class T> T Or(volatile T * ptr, T mask) { __sync_or_and_fetch(ptr, mask); } -template <class T> T And(volatile T * ptr, T mask) { __sync_and_and_fetch(ptr, mask); } -template <class T> T Xor(volatile T * ptr, T mask) { __sync_xor_and_fetch(ptr, mask); } -template <class T> T Nand(volatile T * ptr, T mask) { __sync_nand_and_fetch(ptr, mask); } -template <class T> T Increment(volatile T * ptr, T delta = 1) { __sync_add_and_fetch(ptr, delta); } -template <class T> T Decrement(volatile T * ptr, T delta = 1) { __sync_sub_and_fetch(ptr, delta); } +template <class T> T Or(volatile T * ptr, T mask) { return __sync_or_and_fetch(ptr, mask); } +template <class T> T And(volatile T * ptr, T mask) { return __sync_and_and_fetch(ptr, mask); } +template <class T> T Xor(volatile T * ptr, T mask) { return __sync_xor_and_fetch(ptr, mask); } +template <class T> T Nand(volatile T * ptr, T mask) { return __sync_nand_and_fetch(ptr, mask); } +template <class T> T Increment(volatile T * ptr, T delta = 1) { return __sync_add_and_fetch(ptr, delta); } +template <class T> T Decrement(volatile T * ptr, T delta = 1) { return __sync_sub_and_fetch(ptr, delta); } namespace Prefetch { -template <class T> T Or(volatile T * ptr, T mask) { __sync_fetch_and_or(ptr, mask); } -template <class T> T And(volatile T * ptr, T mask) { __sync_fetch_and_and(ptr, mask); } -template <class T> T Xor(volatile T * ptr, T mask) { __sync_fetch_and_xor(ptr, mask); } -template <class T> T Nand(volatile T * ptr, T mask) { __sync_fetch_and_nand(ptr, mask); } -template <class T> T Increment(volatile T * ptr, T delta = 1) { __sync_fetch_and_add(ptr, delta); } -template <class T> T Decrement(volatile T * ptr, T delta = 1) { __sync_fetch_and_sub(ptr, delta); } +template <class T> T Or(volatile T * ptr, T mask) { return __sync_fetch_and_or(ptr, mask); } +template <class T> T And(volatile T * ptr, T mask) { return __sync_fetch_and_and(ptr, mask); } +template <class T> T Xor(volatile T * ptr, T mask) { return __sync_fetch_and_xor(ptr, mask); } +template <class T> T Nand(volatile T * ptr, T mask) { return __sync_fetch_and_nand(ptr, mask); } +template <class T> T Increment(volatile T * ptr, T delta = 1) { return __sync_fetch_and_add(ptr, delta); } +template <class T> T Decrement(volatile T * ptr, T delta = 1) { return __sync_fetch_and_sub(ptr, delta); } }; template <class T> T CmpXChgVal(volatile T * ptr, const T xch, const T cmp) { return __sync_val_compare_and_swap(ptr, cmp, xch); } |