mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 14:08:37 +00:00
CellSpurs initialization
This commit is contained in:
parent
df84e89d46
commit
bb77249ac8
22 changed files with 599 additions and 272 deletions
|
|
@ -153,7 +153,7 @@ union u128
|
|||
|
||||
std::string to_hex() const
|
||||
{
|
||||
return fmt::Format("%16llx%16llx", _u64[1], _u64[0]);
|
||||
return fmt::Format("%016llx%016llx", _u64[1], _u64[0]);
|
||||
}
|
||||
|
||||
std::string to_xyzw() const
|
||||
|
|
|
|||
|
|
@ -13,13 +13,21 @@
|
|||
#endif
|
||||
|
||||
template<size_t size>
|
||||
void strcpy_trunc(char (&dst)[size], const std::string& src)
|
||||
void strcpy_trunc(char(&dst)[size], const std::string& src)
|
||||
{
|
||||
const size_t count = (src.size() >= size) ? size - 1 /* truncation */ : src.size();
|
||||
memcpy(dst, src.c_str(), count);
|
||||
dst[count] = 0;
|
||||
}
|
||||
|
||||
template<size_t size, size_t rsize>
|
||||
void strcpy_trunc(char(&dst)[size], const char(&src)[rsize])
|
||||
{
|
||||
const size_t count = (rsize >= size) ? size - 1 /* truncation */ : rsize;
|
||||
memcpy(dst, src, count);
|
||||
dst[count] = 0;
|
||||
}
|
||||
|
||||
#if defined(__GNUG__)
|
||||
#include <cmath>
|
||||
#include <stdlib.h>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@ template
|
|||
class SMutexBase
|
||||
{
|
||||
static_assert(sizeof(T) == sizeof(std::atomic<T>), "Invalid SMutexBase type");
|
||||
std::atomic<T> owner;
|
||||
T owner;
|
||||
typedef std::atomic<T> AT;
|
||||
|
||||
public:
|
||||
static const T GetFreeValue()
|
||||
|
|
@ -45,10 +46,10 @@ public:
|
|||
owner = GetFreeValue();
|
||||
}
|
||||
|
||||
SMutexBase()
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
//SMutexBase()
|
||||
//{
|
||||
// initialize();
|
||||
//}
|
||||
|
||||
void finalize()
|
||||
{
|
||||
|
|
@ -68,7 +69,7 @@ public:
|
|||
}
|
||||
T old = GetFreeValue();
|
||||
|
||||
if (!owner.compare_exchange_strong(old, tid))
|
||||
if (!reinterpret_cast<AT&>(owner).compare_exchange_strong(old, tid))
|
||||
{
|
||||
if (old == tid)
|
||||
{
|
||||
|
|
@ -92,7 +93,7 @@ public:
|
|||
}
|
||||
T old = tid;
|
||||
|
||||
if (!owner.compare_exchange_strong(old, to))
|
||||
if (!reinterpret_cast<AT&>(owner).compare_exchange_strong(old, to))
|
||||
{
|
||||
if (old == GetFreeValue())
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue