summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/Atomic.h24
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); }