diff options
Diffstat (limited to 'core/safe_refcount.h')
-rw-r--r-- | core/safe_refcount.h | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/core/safe_refcount.h b/core/safe_refcount.h index 953a877397..8e23a0cf94 100644 --- a/core/safe_refcount.h +++ b/core/safe_refcount.h @@ -43,7 +43,6 @@ template <class T> static _ALWAYS_INLINE_ T atomic_conditional_increment(volatile T *pw) { - if (*pw == 0) return 0; @@ -54,7 +53,6 @@ static _ALWAYS_INLINE_ T atomic_conditional_increment(volatile T *pw) { template <class T> static _ALWAYS_INLINE_ T atomic_decrement(volatile T *pw) { - (*pw)--; return *pw; @@ -62,7 +60,6 @@ static _ALWAYS_INLINE_ T atomic_decrement(volatile T *pw) { template <class T> static _ALWAYS_INLINE_ T atomic_increment(volatile T *pw) { - (*pw)++; return *pw; @@ -70,7 +67,6 @@ static _ALWAYS_INLINE_ T atomic_increment(volatile T *pw) { template <class T, class V> static _ALWAYS_INLINE_ T atomic_sub(volatile T *pw, volatile V val) { - (*pw) -= val; return *pw; @@ -78,7 +74,6 @@ static _ALWAYS_INLINE_ T atomic_sub(volatile T *pw, volatile V val) { template <class T, class V> static _ALWAYS_INLINE_ T atomic_add(volatile T *pw, volatile V val) { - (*pw) += val; return *pw; @@ -86,7 +81,6 @@ static _ALWAYS_INLINE_ T atomic_add(volatile T *pw, volatile V val) { template <class T, class V> static _ALWAYS_INLINE_ T atomic_exchange_if_greater(volatile T *pw, volatile V val) { - if (val > *pw) *pw = val; @@ -102,7 +96,6 @@ static _ALWAYS_INLINE_ T atomic_exchange_if_greater(volatile T *pw, volatile V v template <class T> static _ALWAYS_INLINE_ T atomic_conditional_increment(volatile T *pw) { - while (true) { T tmp = static_cast<T const volatile &>(*pw); if (tmp == 0) @@ -114,31 +107,26 @@ static _ALWAYS_INLINE_ T atomic_conditional_increment(volatile T *pw) { template <class T> static _ALWAYS_INLINE_ T atomic_decrement(volatile T *pw) { - return __sync_sub_and_fetch(pw, 1); } template <class T> static _ALWAYS_INLINE_ T atomic_increment(volatile T *pw) { - return __sync_add_and_fetch(pw, 1); } template <class T, class V> static _ALWAYS_INLINE_ T atomic_sub(volatile T *pw, volatile V val) { - return __sync_sub_and_fetch(pw, val); } template <class T, class V> static _ALWAYS_INLINE_ T atomic_add(volatile T *pw, volatile V val) { - return __sync_add_and_fetch(pw, val); } template <class T, class V> static _ALWAYS_INLINE_ T atomic_exchange_if_greater(volatile T *pw, volatile V val) { - while (true) { T tmp = static_cast<T const volatile &>(*pw); if (tmp >= val) @@ -171,7 +159,6 @@ uint64_t atomic_exchange_if_greater(volatile uint64_t *pw, volatile uint64_t val #endif struct SafeRefCount { - uint32_t count; public: @@ -203,7 +190,6 @@ public: } _ALWAYS_INLINE_ void init(uint32_t p_value = 1) { - count = p_value; } }; |