mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 06:21:26 +12:00
Fix
This commit is contained in:
parent
7037da80cb
commit
26e5a07905
2 changed files with 11 additions and 8 deletions
|
@ -93,27 +93,27 @@ template<typename T> static inline typename std::enable_if<std::is_arithmetic<T>
|
||||||
return __sync_lock_test_and_set(dest, value);
|
return __sync_lock_test_and_set(dest, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> static inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type sync_lock_fetch_and_add(volatile T* dest, T value)
|
template<typename T> static inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type sync_fetch_and_add(volatile T* dest, T value)
|
||||||
{
|
{
|
||||||
return __sync_lock_fetch_and_add(dest, value);
|
return __sync_lock_fetch_and_add(dest, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> static inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type sync_lock_fetch_and_sub(volatile T* dest, T value)
|
template<typename T> static inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type sync_fetch_and_sub(volatile T* dest, T value)
|
||||||
{
|
{
|
||||||
return __sync_lock_fetch_and_sub(dest, value);
|
return __sync_lock_fetch_and_sub(dest, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> static inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type sync_lock_fetch_and_or(volatile T* dest, T value)
|
template<typename T> static inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type sync_fetch_and_or(volatile T* dest, T value)
|
||||||
{
|
{
|
||||||
return __sync_lock_fetch_and_or(dest, value);
|
return __sync_lock_fetch_and_or(dest, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> static inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type sync_lock_fetch_and_and(volatile T* dest, T value)
|
template<typename T> static inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type sync_fetch_and_and(volatile T* dest, T value)
|
||||||
{
|
{
|
||||||
return __sync_lock_fetch_and_and(dest, value);
|
return __sync_lock_fetch_and_and(dest, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> static inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type sync_lock_fetch_and_xor(volatile T* dest, T value)
|
template<typename T> static inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type sync_fetch_and_xor(volatile T* dest, T value)
|
||||||
{
|
{
|
||||||
return __sync_lock_fetch_and_xor(dest, value);
|
return __sync_lock_fetch_and_xor(dest, value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,8 @@ public:
|
||||||
// read data with memory barrier
|
// read data with memory barrier
|
||||||
__forceinline const type read_sync() const volatile
|
__forceinline const type read_sync() const volatile
|
||||||
{
|
{
|
||||||
return from_subtype(sync_val_compare_and_swap(const_cast<subtype*>(&sub_data), 0, 0));
|
const subtype zero = {};
|
||||||
|
return from_subtype(sync_val_compare_and_swap(const_cast<subtype*>(&sub_data), zero, zero));
|
||||||
}
|
}
|
||||||
|
|
||||||
// atomically replace data with exch, return previous data value
|
// atomically replace data with exch, return previous data value
|
||||||
|
@ -126,7 +127,8 @@ public:
|
||||||
// perform atomic operation on data with additional memory barrier
|
// perform atomic operation on data with additional memory barrier
|
||||||
template<typename FT> __forceinline void atomic_op_sync(const FT atomic_proc) volatile
|
template<typename FT> __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)
|
while (true)
|
||||||
{
|
{
|
||||||
subtype _new = old;
|
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)
|
// perform atomic operation on data with additional memory barrier and special exit condition (if intermediate result != proceed_value)
|
||||||
template<typename RT, typename FT> __forceinline RT atomic_op_sync(const RT proceed_value, const FT atomic_proc) volatile
|
template<typename RT, typename FT> __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)
|
while (true)
|
||||||
{
|
{
|
||||||
subtype _new = old;
|
subtype _new = old;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue