mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-04-05 06:26:38 +00:00
fix small merge mistake
This commit is contained in:
commit
1be8563fdb
47 changed files with 3065 additions and 785 deletions
|
|
@ -2,17 +2,14 @@
|
|||
|
||||
#include "Utilities/GNU.h"
|
||||
|
||||
#define se16(x) const_se_t<u16, x>::value
|
||||
#define se32(x) const_se_t<u32, x>::value
|
||||
#define se64(x) const_se_t<u64, x>::value
|
||||
|
||||
template<typename T, int size = sizeof(T)> struct se_t;
|
||||
template<typename T> struct se_t<T, 1> { static __forceinline void func(T& dst, const T src) { (u8&)dst = (u8&)src; } };
|
||||
template<typename T> struct se_t<T, 2> { static __forceinline void func(T& dst, const T src) { (u16&)dst = _byteswap_ushort((u16&)src); } };
|
||||
template<typename T> struct se_t<T, 4> { static __forceinline void func(T& dst, const T src) { (u32&)dst = _byteswap_ulong((u32&)src); } };
|
||||
template<typename T> struct se_t<T, 8> { static __forceinline void func(T& dst, const T src) { (u64&)dst = _byteswap_uint64((u64&)src); } };
|
||||
|
||||
template<typename T, s64 _value, int size = sizeof(T)> struct const_se_t;;
|
||||
|
||||
template<typename T, s64 _value, int size = sizeof(T)> struct const_se_t;
|
||||
template<typename T, s64 _value> struct const_se_t<T, _value, 1>
|
||||
{
|
||||
static const T value = (T)_value;
|
||||
|
|
@ -52,6 +49,7 @@ class be_t
|
|||
T m_data;
|
||||
|
||||
public:
|
||||
typedef T type;
|
||||
be_t() noexcept = default;
|
||||
|
||||
be_t(const T& value)
|
||||
|
|
@ -89,6 +87,20 @@ public:
|
|||
se_t<T>::func(m_data, value);
|
||||
}
|
||||
|
||||
static be_t MakeFromLE(const T value)
|
||||
{
|
||||
be_t res;
|
||||
res.FromLE(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
static be_t MakeFromBE(const T value)
|
||||
{
|
||||
be_t res;
|
||||
res.FromBE(value);
|
||||
return res;
|
||||
}
|
||||
|
||||
//template<typename T1>
|
||||
operator const T() const
|
||||
{
|
||||
|
|
@ -152,4 +164,17 @@ public:
|
|||
template<typename T1> bool operator < (const be_t<T1>& right) const { return (T1)ToLE() < right.ToLE(); }
|
||||
template<typename T1> bool operator >= (const be_t<T1>& right) const { return (T1)ToLE() >= right.ToLE(); }
|
||||
template<typename T1> bool operator <= (const be_t<T1>& right) const { return (T1)ToLE() <= right.ToLE(); }
|
||||
|
||||
be_t operator++ (int) { be_t res = *this; *this += 1; return res; }
|
||||
be_t operator-- (int) { be_t res = *this; *this -= 1; return res; }
|
||||
be_t& operator++ () { *this += 1; return *this; }
|
||||
be_t& operator-- () { *this -= 1; return *this; }
|
||||
};
|
||||
|
||||
template<typename T, typename T1, T1 value> struct _se : public const_se_t<T, value> {};
|
||||
template<typename T, typename T1, T1 value> struct _se<be_t<T>, T1, value> : public const_se_t<T, value> {};
|
||||
|
||||
#define se(t, x) _se<decltype(t), decltype(x), x>::value
|
||||
#define se16(x) _se<u16, decltype(x), x>::value
|
||||
#define se32(x) _se<u32, decltype(x), x>::value
|
||||
#define se64(x) _se<u64, decltype(x), x>::value
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ public:
|
|||
struct ID
|
||||
{
|
||||
std::string m_name;
|
||||
u8 m_attr;
|
||||
u32 m_attr;
|
||||
IDData* m_data;
|
||||
|
||||
template<typename T>
|
||||
ID(const std::string& name, T* data, const u8 attr)
|
||||
ID(const std::string& name, T* data, const u32 attr)
|
||||
: m_name(name)
|
||||
, m_attr(attr)
|
||||
{
|
||||
|
|
@ -97,7 +97,7 @@ public:
|
|||
}
|
||||
|
||||
template<typename T = char>
|
||||
ID_TYPE GetNewID(const std::string& name = "", T* data = nullptr, const u8 attr = 0)
|
||||
ID_TYPE GetNewID(const std::string& name = "", T* data = nullptr, const u32 attr = 0)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mtx_main);
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,11 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
void initialize()
|
||||
{
|
||||
(T&)owner = free_value;
|
||||
}
|
||||
|
||||
~SMutexBase()
|
||||
{
|
||||
lock((T)dead_value);
|
||||
|
|
@ -46,6 +51,16 @@ public:
|
|||
return (T&)owner;
|
||||
}
|
||||
|
||||
__forceinline T GetFreeValue() const
|
||||
{
|
||||
return (T)free_value;
|
||||
}
|
||||
|
||||
__forceinline T GetDeadValue() const
|
||||
{
|
||||
return (T)dead_value;
|
||||
}
|
||||
|
||||
SMutexResult trylock(T tid)
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
|
|
|
|||
|
|
@ -115,10 +115,11 @@ void thread::start(std::function<void()> func)
|
|||
{ // got a crash related with strings
|
||||
m_thr = std::thread([this, func]()
|
||||
{
|
||||
NamedThreadBase info(m_name);
|
||||
g_tls_this_thread = &info;
|
||||
|
||||
try
|
||||
{
|
||||
NamedThreadBase info(m_name);
|
||||
g_tls_this_thread = &info;
|
||||
func();
|
||||
}
|
||||
catch(...)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue