1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 20:22:30 +01:00

atomic_t specializations fixed

This commit is contained in:
Nekotekina 2015-03-10 19:27:08 +03:00
parent befc0f62b8
commit 11b409907e

View File

@ -197,11 +197,11 @@ public:
}
};
__forceinline static u64 operator ++(_atomic_base<be_t<u64>>& left, int)
template<typename T> inline static typename std::enable_if<std::is_arithmetic<T>::value, T>::type operator ++(_atomic_base<be_t<T>>& left, int)
{
u64 result;
T result;
left.atomic_op([&result](be_t<u64>& value)
left.atomic_op([&result](be_t<T>& value)
{
result = value++;
});
@ -209,7 +209,7 @@ __forceinline static u64 operator ++(_atomic_base<be_t<u64>>& left, int)
return result;
}
__forceinline static u64 operator --(_atomic_base<be_t<u64>>& left, int)
template<typename T> inline static typename std::enable_if<std::is_arithmetic<T>::value, T>::type operator --(_atomic_base<be_t<T>>& left, int)
{
u64 result;
@ -221,11 +221,11 @@ __forceinline static u64 operator --(_atomic_base<be_t<u64>>& left, int)
return result;
}
__forceinline static u64 operator +=(_atomic_base<be_t<u64>>& left, u64 right)
template<typename T, typename T2> inline static typename std::enable_if<std::is_arithmetic<T>::value, T>::type operator +=(_atomic_base<be_t<T>>& left, T2 right)
{
u64 result;
T result;
left.atomic_op([&result, right](be_t<u64>& value)
left.atomic_op([&result, right](be_t<T>& value)
{
result = (value += right);
});
@ -233,6 +233,18 @@ __forceinline static u64 operator +=(_atomic_base<be_t<u64>>& left, u64 right)
return result;
}
template<typename T, typename T2> inline static typename std::enable_if<std::is_arithmetic<T>::value, T>::type operator -=(_atomic_base<be_t<T>>& left, T2 right)
{
T result;
left.atomic_op([&result, right](be_t<T>& value)
{
result = (value -= right);
});
return result;
}
template<typename T> using atomic_le_t = _atomic_base<T>;
template<typename T> using atomic_be_t = _atomic_base<typename to_be_t<T>::type>;