From 26e5a07905c76a1ed3a39f3ddd461f3fd82e56c7 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Wed, 27 May 2015 13:55:15 +0300 Subject: [PATCH] Fix --- Utilities/GNU.h | 10 +++++----- rpcs3/Emu/Memory/atomic.h | 9 ++++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Utilities/GNU.h b/Utilities/GNU.h index deff6a051a..d3ecaa2be0 100644 --- a/Utilities/GNU.h +++ b/Utilities/GNU.h @@ -93,27 +93,27 @@ template static inline typename std::enable_if return __sync_lock_test_and_set(dest, value); } -template static inline typename std::enable_if::value, T>::type sync_lock_fetch_and_add(volatile T* dest, T value) +template static inline typename std::enable_if::value, T>::type sync_fetch_and_add(volatile T* dest, T value) { return __sync_lock_fetch_and_add(dest, value); } -template static inline typename std::enable_if::value, T>::type sync_lock_fetch_and_sub(volatile T* dest, T value) +template static inline typename std::enable_if::value, T>::type sync_fetch_and_sub(volatile T* dest, T value) { return __sync_lock_fetch_and_sub(dest, value); } -template static inline typename std::enable_if::value, T>::type sync_lock_fetch_and_or(volatile T* dest, T value) +template static inline typename std::enable_if::value, T>::type sync_fetch_and_or(volatile T* dest, T value) { return __sync_lock_fetch_and_or(dest, value); } -template static inline typename std::enable_if::value, T>::type sync_lock_fetch_and_and(volatile T* dest, T value) +template static inline typename std::enable_if::value, T>::type sync_fetch_and_and(volatile T* dest, T value) { return __sync_lock_fetch_and_and(dest, value); } -template static inline typename std::enable_if::value, T>::type sync_lock_fetch_and_xor(volatile T* dest, T value) +template static inline typename std::enable_if::value, T>::type sync_fetch_and_xor(volatile T* dest, T value) { return __sync_lock_fetch_and_xor(dest, value); } diff --git a/rpcs3/Emu/Memory/atomic.h b/rpcs3/Emu/Memory/atomic.h index 0fce3137b4..2267f2d637 100644 --- a/rpcs3/Emu/Memory/atomic.h +++ b/rpcs3/Emu/Memory/atomic.h @@ -76,7 +76,8 @@ public: // read data with memory barrier __forceinline const type read_sync() const volatile { - return from_subtype(sync_val_compare_and_swap(const_cast(&sub_data), 0, 0)); + const subtype zero = {}; + return from_subtype(sync_val_compare_and_swap(const_cast(&sub_data), zero, zero)); } // atomically replace data with exch, return previous data value @@ -126,7 +127,8 @@ public: // perform atomic operation on data with additional memory barrier template __forceinline void atomic_op_sync(const FT atomic_proc) volatile { - subtype old = sync_val_compare_and_swap(&sub_data, 0, 0); + const subtype zero = {}; + subtype old = sync_val_compare_and_swap(&sub_data, zero, zero); while (true) { subtype _new = old; @@ -140,7 +142,8 @@ public: // perform atomic operation on data with additional memory barrier and special exit condition (if intermediate result != proceed_value) template __forceinline RT atomic_op_sync(const RT proceed_value, const FT atomic_proc) volatile { - subtype old = sync_val_compare_and_swap(&sub_data, 0, 0); + const subtype zero = {}; + subtype old = sync_val_compare_and_swap(&sub_data, zero, zero); while (true) { subtype _new = old;