mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-13 10:18:40 +12:00
Threads improved, ID manager improved
This commit is contained in:
parent
78bfd54ad4
commit
ca6783ba9a
48 changed files with 1113 additions and 990 deletions
|
@ -164,17 +164,19 @@ template<typename T1, typename T2, typename T3 = const char*> struct triplet_t
|
|||
// return 32 bit .size() for container
|
||||
template<typename T> inline auto size32(const T& container) -> decltype(static_cast<u32>(container.size()))
|
||||
{
|
||||
return container.size() <= UINT32_MAX ? static_cast<u32>(container.size()) : throw std::length_error(__FUNCTION__);
|
||||
const auto size = container.size();
|
||||
return size >= 0 && size <= UINT32_MAX ? static_cast<u32>(size) : throw std::length_error(__FUNCTION__);
|
||||
}
|
||||
|
||||
// return 32 bit size for an array
|
||||
template<typename T, std::size_t Size> constexpr u32 size32(const T(&)[Size])
|
||||
{
|
||||
return Size <= UINT32_MAX ? static_cast<u32>(Size) : throw std::length_error(__FUNCTION__);
|
||||
return Size >= 0 && Size <= UINT32_MAX ? static_cast<u32>(Size) : throw std::length_error(__FUNCTION__);
|
||||
}
|
||||
|
||||
#define WRAP_EXPR(expr) [&]{ return expr; }
|
||||
#define COPY_EXPR(expr) [=]{ return expr; }
|
||||
#define PURE_EXPR(expr) [] { return expr; }
|
||||
#define EXCEPTION(text, ...) fmt::exception(__FILE__, __LINE__, __FUNCTION__, text, ##__VA_ARGS__)
|
||||
#define VM_CAST(value) vm::impl_cast(value, __FILE__, __LINE__, __FUNCTION__)
|
||||
#define IS_INTEGRAL(t) (std::is_integral<t>::value || std::is_same<std::decay_t<t>, u128>::value)
|
||||
|
@ -183,6 +185,7 @@ template<typename T, std::size_t Size> constexpr u32 size32(const T(&)[Size])
|
|||
#define CHECK_ASSERTION(expr) if (expr) {} else throw EXCEPTION("Assertion failed: " #expr)
|
||||
#define CHECK_SUCCESS(expr) if (s32 _r = (expr)) throw EXCEPTION(#expr " failed (0x%x)", _r)
|
||||
|
||||
// Some forward declarations for the ID manager
|
||||
template<typename T> struct id_traits;
|
||||
|
||||
#define _PRGNAME_ "RPCS3"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue