Attribute macro changed

__forceinline -> force_inline
__noinline -> never_inline
printf_alike(x,y) added
This commit is contained in:
Nekotekina 2015-05-28 18:14:22 +03:00
parent f83306b0bf
commit 78fdcf75e7
32 changed files with 395 additions and 393 deletions

View File

@ -2,7 +2,7 @@
#define IS_LE_MACHINE
union _CRT_ALIGN(16) u128
union u128
{
u64 _u64[2];
s64 _s64[2];
@ -107,12 +107,12 @@ union _CRT_ALIGN(16) u128
{
}
__forceinline operator bool() const
force_inline operator bool() const
{
return (data & mask) != 0;
}
__forceinline bit_element& operator = (const bool right)
force_inline bit_element& operator = (const bool right)
{
if (right)
{
@ -125,7 +125,7 @@ union _CRT_ALIGN(16) u128
return *this;
}
__forceinline bit_element& operator = (const bit_element& right)
force_inline bit_element& operator = (const bit_element& right)
{
if (right)
{
@ -249,77 +249,77 @@ union _CRT_ALIGN(16) u128
return ret;
}
static __forceinline u128 add8(const u128& left, const u128& right)
static force_inline u128 add8(const u128& left, const u128& right)
{
return fromV(_mm_add_epi8(left.vi, right.vi));
}
static __forceinline u128 add16(const u128& left, const u128& right)
static force_inline u128 add16(const u128& left, const u128& right)
{
return fromV(_mm_add_epi16(left.vi, right.vi));
}
static __forceinline u128 add32(const u128& left, const u128& right)
static force_inline u128 add32(const u128& left, const u128& right)
{
return fromV(_mm_add_epi32(left.vi, right.vi));
}
static __forceinline u128 addfs(const u128& left, const u128& right)
static force_inline u128 addfs(const u128& left, const u128& right)
{
return fromF(_mm_add_ps(left.vf, right.vf));
}
static __forceinline u128 addfd(const u128& left, const u128& right)
static force_inline u128 addfd(const u128& left, const u128& right)
{
return fromD(_mm_add_pd(left.vd, right.vd));
}
static __forceinline u128 sub8(const u128& left, const u128& right)
static force_inline u128 sub8(const u128& left, const u128& right)
{
return fromV(_mm_sub_epi8(left.vi, right.vi));
}
static __forceinline u128 sub16(const u128& left, const u128& right)
static force_inline u128 sub16(const u128& left, const u128& right)
{
return fromV(_mm_sub_epi16(left.vi, right.vi));
}
static __forceinline u128 sub32(const u128& left, const u128& right)
static force_inline u128 sub32(const u128& left, const u128& right)
{
return fromV(_mm_sub_epi32(left.vi, right.vi));
}
static __forceinline u128 subfs(const u128& left, const u128& right)
static force_inline u128 subfs(const u128& left, const u128& right)
{
return fromF(_mm_sub_ps(left.vf, right.vf));
}
static __forceinline u128 subfd(const u128& left, const u128& right)
static force_inline u128 subfd(const u128& left, const u128& right)
{
return fromD(_mm_sub_pd(left.vd, right.vd));
}
static __forceinline u128 maxu8(const u128& left, const u128& right)
static force_inline u128 maxu8(const u128& left, const u128& right)
{
return fromV(_mm_max_epu8(left.vi, right.vi));
}
static __forceinline u128 minu8(const u128& left, const u128& right)
static force_inline u128 minu8(const u128& left, const u128& right)
{
return fromV(_mm_min_epu8(left.vi, right.vi));
}
static __forceinline u128 eq8(const u128& left, const u128& right)
static force_inline u128 eq8(const u128& left, const u128& right)
{
return fromV(_mm_cmpeq_epi8(left.vi, right.vi));
}
static __forceinline u128 eq16(const u128& left, const u128& right)
static force_inline u128 eq16(const u128& left, const u128& right)
{
return fromV(_mm_cmpeq_epi16(left.vi, right.vi));
}
static __forceinline u128 eq32(const u128& left, const u128& right)
static force_inline u128 eq32(const u128& left, const u128& right)
{
return fromV(_mm_cmpeq_epi32(left.vi, right.vi));
}
@ -334,17 +334,17 @@ union _CRT_ALIGN(16) u128
return (_u64[0] != right._u64[0]) || (_u64[1] != right._u64[1]);
}
__forceinline u128 operator | (const u128& right) const
force_inline u128 operator | (const u128& right) const
{
return fromV(_mm_or_si128(vi, right.vi));
}
__forceinline u128 operator & (const u128& right) const
force_inline u128 operator & (const u128& right) const
{
return fromV(_mm_and_si128(vi, right.vi));
}
__forceinline u128 operator ^ (const u128& right) const
force_inline u128 operator ^ (const u128& right) const
{
return fromV(_mm_xor_si128(vi, right.vi));
}
@ -354,18 +354,18 @@ union _CRT_ALIGN(16) u128
return from64(~_u64[0], ~_u64[1]);
}
__forceinline bool is_any_1() const // check if any bit is 1
force_inline bool is_any_1() const // check if any bit is 1
{
return _u64[0] || _u64[1];
}
__forceinline bool is_any_0() const // check if any bit is 0
force_inline bool is_any_0() const // check if any bit is 0
{
return ~_u64[0] || ~_u64[1];
}
// result = (~left) & (right)
static __forceinline u128 andnot(const u128& left, const u128& right)
static force_inline u128 andnot(const u128& left, const u128& right)
{
return fromV(_mm_andnot_si128(left.vi, right.vi));
}
@ -379,7 +379,7 @@ union _CRT_ALIGN(16) u128
std::string to_xyzw() const;
static __forceinline u128 byteswap(const u128 val)
static force_inline u128 byteswap(const u128 val)
{
u128 ret;
ret._u64[0] = _byteswap_uint64(val._u64[1]);
@ -388,7 +388,9 @@ union _CRT_ALIGN(16) u128
}
};
static __forceinline u128 sync_val_compare_and_swap(volatile u128* dest, u128 comp, u128 exch)
static_assert(__alignof(u128) == 16 && sizeof(u128) == 16, "Wrong u128 size or alignment");
static force_inline u128 sync_val_compare_and_swap(volatile u128* dest, u128 comp, u128 exch)
{
#if !defined(_MSC_VER)
auto res = __sync_val_compare_and_swap((volatile __int128_t*)dest, (__int128_t&)comp, (__int128_t&)exch);
@ -399,7 +401,7 @@ static __forceinline u128 sync_val_compare_and_swap(volatile u128* dest, u128 co
#endif
}
static __forceinline bool sync_bool_compare_and_swap(volatile u128* dest, u128 comp, u128 exch)
static force_inline bool sync_bool_compare_and_swap(volatile u128* dest, u128 comp, u128 exch)
{
#if !defined(_MSC_VER)
return __sync_bool_compare_and_swap((volatile __int128_t*)dest, (__int128_t&)comp, (__int128_t&)exch);
@ -408,7 +410,7 @@ static __forceinline bool sync_bool_compare_and_swap(volatile u128* dest, u128 c
#endif
}
static __forceinline u128 sync_lock_test_and_set(volatile u128* dest, u128 value)
static force_inline u128 sync_lock_test_and_set(volatile u128* dest, u128 value)
{
while (true)
{
@ -417,7 +419,7 @@ static __forceinline u128 sync_lock_test_and_set(volatile u128* dest, u128 value
}
}
static __forceinline u128 sync_fetch_and_or(volatile u128* dest, u128 value)
static force_inline u128 sync_fetch_and_or(volatile u128* dest, u128 value)
{
while (true)
{
@ -426,7 +428,7 @@ static __forceinline u128 sync_fetch_and_or(volatile u128* dest, u128 value)
}
}
static __forceinline u128 sync_fetch_and_and(volatile u128* dest, u128 value)
static force_inline u128 sync_fetch_and_and(volatile u128* dest, u128 value)
{
while (true)
{
@ -435,7 +437,7 @@ static __forceinline u128 sync_fetch_and_and(volatile u128* dest, u128 value)
}
}
static __forceinline u128 sync_fetch_and_xor(volatile u128* dest, u128 value)
static force_inline u128 sync_fetch_and_xor(volatile u128* dest, u128 value)
{
while (true)
{
@ -453,12 +455,12 @@ template<typename T, int size = sizeof(T)> struct se_t;
template<typename T> struct se_t<T, 1>
{
static __forceinline u8 to_be(const T& src)
static force_inline u8 to_be(const T& src)
{
return (u8&)src;
}
static __forceinline T from_be(const u8 src)
static force_inline T from_be(const u8 src)
{
return (T&)src;
}
@ -466,12 +468,12 @@ template<typename T> struct se_t<T, 1>
template<typename T> struct se_t<T, 2>
{
static __forceinline u16 to_be(const T& src)
static force_inline u16 to_be(const T& src)
{
return _byteswap_ushort((u16&)src);
}
static __forceinline T from_be(const u16 src)
static force_inline T from_be(const u16 src)
{
const u16 res = _byteswap_ushort(src);
return (T&)res;
@ -480,12 +482,12 @@ template<typename T> struct se_t<T, 2>
template<typename T> struct se_t<T, 4>
{
static __forceinline u32 to_be(const T& src)
static force_inline u32 to_be(const T& src)
{
return _byteswap_ulong((u32&)src);
}
static __forceinline T from_be(const u32 src)
static force_inline T from_be(const u32 src)
{
const u32 res = _byteswap_ulong(src);
return (T&)res;
@ -494,12 +496,12 @@ template<typename T> struct se_t<T, 4>
template<typename T> struct se_t<T, 8>
{
static __forceinline u64 to_be(const T& src)
static force_inline u64 to_be(const T& src)
{
return _byteswap_uint64((u64&)src);
}
static __forceinline T from_be(const u64 src)
static force_inline T from_be(const u64 src)
{
const u64 res = _byteswap_uint64(src);
return (T&)res;
@ -508,12 +510,12 @@ template<typename T> struct se_t<T, 8>
template<typename T> struct se_t<T, 16>
{
static __forceinline u128 to_be(const T& src)
static force_inline u128 to_be(const T& src)
{
return u128::byteswap((u128&)src);
}
static __forceinline T from_be(const u128& src)
static force_inline T from_be(const u128& src)
{
const u128 res = u128::byteswap(src);
return (T&)res;
@ -603,7 +605,7 @@ private:
template<typename Tto, typename Tfrom, int mode>
struct _convert
{
static __forceinline be_t<Tto>& func(Tfrom& be_value)
static force_inline be_t<Tto>& func(Tfrom& be_value)
{
Tto res = be_value;
return (be_t<Tto>&)res;
@ -613,7 +615,7 @@ private:
template<typename Tto, typename Tfrom>
struct _convert<Tto, Tfrom, 1>
{
static __forceinline be_t<Tto>& func(Tfrom& be_value)
static force_inline be_t<Tto>& func(Tfrom& be_value)
{
Tto res = se_t<Tto, sizeof(Tto)>::func(se_t<Tfrom, sizeof(Tfrom)>::func(be_value));
return (be_t<Tto>&)res;
@ -623,7 +625,7 @@ private:
template<typename Tto, typename Tfrom>
struct _convert<Tto, Tfrom, 2>
{
static __forceinline be_t<Tto>& func(Tfrom& be_value)
static force_inline be_t<Tto>& func(Tfrom& be_value)
{
Tto res = be_value >> ((sizeof(Tfrom)-sizeof(Tto)) * 8);
return (be_t<Tto>&)res;
@ -673,7 +675,7 @@ public:
}
//get value in current machine byte ordering
__forceinline type value() const
force_inline type value() const
{
#ifdef IS_LE_MACHINE
return ToLE();
@ -906,13 +908,13 @@ struct convert_le_be_t<Tto, be_t<Tf, Tf1>>
};
template<typename Tto, typename Tfrom>
__forceinline Tto convert_le_be(Tfrom&& value)
force_inline Tto convert_le_be(Tfrom&& value)
{
return convert_le_be_t<Tto, Tfrom>::func(value);
}
template<typename Tto, typename Tfrom>
__forceinline void convert_le_be(Tto& dst, Tfrom&& src)
force_inline void convert_le_be(Tto& dst, Tfrom&& src)
{
dst = convert_le_be_t<Tto, Tfrom>::func(src);
}

View File

@ -2,22 +2,34 @@
#include <emmintrin.h>
#ifdef _WIN32
#if defined(_MSC_VER)
#define thread_local __declspec(thread)
#elif __APPLE__
#define thread_local __thread
#endif
#ifdef _WIN32
#define __noinline __declspec(noinline)
#if defined(_MSC_VER)
#define never_inline __declspec(noinline)
#else
#define __noinline __attribute__((noinline))
#define never_inline __attribute__((noinline))
#endif
#ifdef _WIN32
#define __safebuffers __declspec(safebuffers)
#if defined(_MSC_VER)
#define safe_buffers __declspec(safebuffers)
#else
#define __safebuffers
#define safe_buffers
#endif
#if defined(_MSC_VER)
#define printf_alike(x, y)
#else
#define printf_alike(x, y) __attribute__((format(printf, x, y)))
#endif
#if defined(_MSC_VER)
#define force_inline __forceinline
#else
#define force_inline __attribute__((always_inline))
#endif
template<size_t size>
@ -46,12 +58,10 @@ void strcpy_trunc(char(&dst)[size], const char(&src)[rsize])
#endif
#define _fpclass(x) std::fpclassify(x)
#define __forceinline __attribute__((always_inline))
#define _byteswap_ushort(x) __builtin_bswap16(x)
#define _byteswap_ulong(x) __builtin_bswap32(x)
#define _byteswap_uint64(x) __builtin_bswap64(x)
#define INFINITE 0xFFFFFFFF
#define _CRT_ALIGN(x) __attribute__((aligned(x)))
inline uint64_t __umulh(uint64_t a, uint64_t b)
{
@ -124,181 +134,181 @@ template<typename T, typename T2> static inline typename std::enable_if<std::is_
// atomic compare and swap functions
static __forceinline uint8_t sync_val_compare_and_swap(volatile uint8_t* dest, uint8_t comp, uint8_t exch)
static force_inline uint8_t sync_val_compare_and_swap(volatile uint8_t* dest, uint8_t comp, uint8_t exch)
{
return _InterlockedCompareExchange8((volatile char*)dest, exch, comp);
}
static __forceinline uint16_t sync_val_compare_and_swap(volatile uint16_t* dest, uint16_t comp, uint16_t exch)
static force_inline uint16_t sync_val_compare_and_swap(volatile uint16_t* dest, uint16_t comp, uint16_t exch)
{
return _InterlockedCompareExchange16((volatile short*)dest, exch, comp);
}
static __forceinline uint32_t sync_val_compare_and_swap(volatile uint32_t* dest, uint32_t comp, uint32_t exch)
static force_inline uint32_t sync_val_compare_and_swap(volatile uint32_t* dest, uint32_t comp, uint32_t exch)
{
return _InterlockedCompareExchange((volatile long*)dest, exch, comp);
}
static __forceinline uint64_t sync_val_compare_and_swap(volatile uint64_t* dest, uint64_t comp, uint64_t exch)
static force_inline uint64_t sync_val_compare_and_swap(volatile uint64_t* dest, uint64_t comp, uint64_t exch)
{
return _InterlockedCompareExchange64((volatile long long*)dest, exch, comp);
}
static __forceinline bool sync_bool_compare_and_swap(volatile uint8_t* dest, uint8_t comp, uint8_t exch)
static force_inline bool sync_bool_compare_and_swap(volatile uint8_t* dest, uint8_t comp, uint8_t exch)
{
return (uint8_t)_InterlockedCompareExchange8((volatile char*)dest, exch, comp) == comp;
}
static __forceinline bool sync_bool_compare_and_swap(volatile uint16_t* dest, uint16_t comp, uint16_t exch)
static force_inline bool sync_bool_compare_and_swap(volatile uint16_t* dest, uint16_t comp, uint16_t exch)
{
return (uint16_t)_InterlockedCompareExchange16((volatile short*)dest, exch, comp) == comp;
}
static __forceinline bool sync_bool_compare_and_swap(volatile uint32_t* dest, uint32_t comp, uint32_t exch)
static force_inline bool sync_bool_compare_and_swap(volatile uint32_t* dest, uint32_t comp, uint32_t exch)
{
return (uint32_t)_InterlockedCompareExchange((volatile long*)dest, exch, comp) == comp;
}
static __forceinline bool sync_bool_compare_and_swap(volatile uint64_t* dest, uint64_t comp, uint64_t exch)
static force_inline bool sync_bool_compare_and_swap(volatile uint64_t* dest, uint64_t comp, uint64_t exch)
{
return (uint64_t)_InterlockedCompareExchange64((volatile long long*)dest, exch, comp) == comp;
}
// atomic exchange functions
static __forceinline uint8_t sync_lock_test_and_set(volatile uint8_t* dest, uint8_t value)
static force_inline uint8_t sync_lock_test_and_set(volatile uint8_t* dest, uint8_t value)
{
return _InterlockedExchange8((volatile char*)dest, value);
}
static __forceinline uint16_t sync_lock_test_and_set(volatile uint16_t* dest, uint16_t value)
static force_inline uint16_t sync_lock_test_and_set(volatile uint16_t* dest, uint16_t value)
{
return _InterlockedExchange16((volatile short*)dest, value);
}
static __forceinline uint32_t sync_lock_test_and_set(volatile uint32_t* dest, uint32_t value)
static force_inline uint32_t sync_lock_test_and_set(volatile uint32_t* dest, uint32_t value)
{
return _InterlockedExchange((volatile long*)dest, value);
}
static __forceinline uint64_t sync_lock_test_and_set(volatile uint64_t* dest, uint64_t value)
static force_inline uint64_t sync_lock_test_and_set(volatile uint64_t* dest, uint64_t value)
{
return _InterlockedExchange64((volatile long long*)dest, value);
}
// atomic add functions
static __forceinline uint8_t sync_fetch_and_add(volatile uint8_t* dest, uint8_t value)
static force_inline uint8_t sync_fetch_and_add(volatile uint8_t* dest, uint8_t value)
{
return _InterlockedExchangeAdd8((volatile char*)dest, value);
}
static __forceinline uint16_t sync_fetch_and_add(volatile uint16_t* dest, uint16_t value)
static force_inline uint16_t sync_fetch_and_add(volatile uint16_t* dest, uint16_t value)
{
return _InterlockedExchangeAdd16((volatile short*)dest, value);
}
static __forceinline uint32_t sync_fetch_and_add(volatile uint32_t* dest, uint32_t value)
static force_inline uint32_t sync_fetch_and_add(volatile uint32_t* dest, uint32_t value)
{
return _InterlockedExchangeAdd((volatile long*)dest, value);
}
static __forceinline uint64_t sync_fetch_and_add(volatile uint64_t* dest, uint64_t value)
static force_inline uint64_t sync_fetch_and_add(volatile uint64_t* dest, uint64_t value)
{
return _InterlockedExchangeAdd64((volatile long long*)dest, value);
}
// atomic sub functions
static __forceinline uint8_t sync_fetch_and_sub(volatile uint8_t* dest, uint8_t value)
static force_inline uint8_t sync_fetch_and_sub(volatile uint8_t* dest, uint8_t value)
{
return _InterlockedExchangeAdd8((volatile char*)dest, -(char)value);
}
static __forceinline uint16_t sync_fetch_and_sub(volatile uint16_t* dest, uint16_t value)
static force_inline uint16_t sync_fetch_and_sub(volatile uint16_t* dest, uint16_t value)
{
return _InterlockedExchangeAdd16((volatile short*)dest, -(short)value);
}
static __forceinline uint32_t sync_fetch_and_sub(volatile uint32_t* dest, uint32_t value)
static force_inline uint32_t sync_fetch_and_sub(volatile uint32_t* dest, uint32_t value)
{
return _InterlockedExchangeAdd((volatile long*)dest, -(long)value);
}
static __forceinline uint64_t sync_fetch_and_sub(volatile uint64_t* dest, uint64_t value)
static force_inline uint64_t sync_fetch_and_sub(volatile uint64_t* dest, uint64_t value)
{
return _InterlockedExchangeAdd64((volatile long long*)dest, -(long long)value);
}
// atomic bitwise or functions
static __forceinline uint8_t sync_fetch_and_or(volatile uint8_t* dest, uint8_t value)
static force_inline uint8_t sync_fetch_and_or(volatile uint8_t* dest, uint8_t value)
{
return _InterlockedOr8((volatile char*)dest, value);
}
static __forceinline uint16_t sync_fetch_and_or(volatile uint16_t* dest, uint16_t value)
static force_inline uint16_t sync_fetch_and_or(volatile uint16_t* dest, uint16_t value)
{
return _InterlockedOr16((volatile short*)dest, value);
}
static __forceinline uint32_t sync_fetch_and_or(volatile uint32_t* dest, uint32_t value)
static force_inline uint32_t sync_fetch_and_or(volatile uint32_t* dest, uint32_t value)
{
return _InterlockedOr((volatile long*)dest, value);
}
static __forceinline uint64_t sync_fetch_and_or(volatile uint64_t* dest, uint64_t value)
static force_inline uint64_t sync_fetch_and_or(volatile uint64_t* dest, uint64_t value)
{
return _InterlockedOr64((volatile long long*)dest, value);
}
// atomic bitwise and functions
static __forceinline uint8_t sync_fetch_and_and(volatile uint8_t* dest, uint8_t value)
static force_inline uint8_t sync_fetch_and_and(volatile uint8_t* dest, uint8_t value)
{
return _InterlockedAnd8((volatile char*)dest, value);
}
static __forceinline uint16_t sync_fetch_and_and(volatile uint16_t* dest, uint16_t value)
static force_inline uint16_t sync_fetch_and_and(volatile uint16_t* dest, uint16_t value)
{
return _InterlockedAnd16((volatile short*)dest, value);
}
static __forceinline uint32_t sync_fetch_and_and(volatile uint32_t* dest, uint32_t value)
static force_inline uint32_t sync_fetch_and_and(volatile uint32_t* dest, uint32_t value)
{
return _InterlockedAnd((volatile long*)dest, value);
}
static __forceinline uint64_t sync_fetch_and_and(volatile uint64_t* dest, uint64_t value)
static force_inline uint64_t sync_fetch_and_and(volatile uint64_t* dest, uint64_t value)
{
return _InterlockedAnd64((volatile long long*)dest, value);
}
// atomic bitwise xor functions
static __forceinline uint8_t sync_fetch_and_xor(volatile uint8_t* dest, uint8_t value)
static force_inline uint8_t sync_fetch_and_xor(volatile uint8_t* dest, uint8_t value)
{
return _InterlockedXor8((volatile char*)dest, value);
}
static __forceinline uint16_t sync_fetch_and_xor(volatile uint16_t* dest, uint16_t value)
static force_inline uint16_t sync_fetch_and_xor(volatile uint16_t* dest, uint16_t value)
{
return _InterlockedXor16((volatile short*)dest, value);
}
static __forceinline uint32_t sync_fetch_and_xor(volatile uint32_t* dest, uint32_t value)
static force_inline uint32_t sync_fetch_and_xor(volatile uint32_t* dest, uint32_t value)
{
return _InterlockedXor((volatile long*)dest, value);
}
static __forceinline uint64_t sync_fetch_and_xor(volatile uint64_t* dest, uint64_t value)
static force_inline uint64_t sync_fetch_and_xor(volatile uint64_t* dest, uint64_t value)
{
return _InterlockedXor64((volatile long long*)dest, value);
}
#endif /* _MSC_VER */
static __forceinline uint32_t cntlz32(uint32_t arg)
static force_inline uint32_t cntlz32(uint32_t arg)
{
#if defined(_MSC_VER)
unsigned long res;
@ -322,7 +332,7 @@ static __forceinline uint32_t cntlz32(uint32_t arg)
#endif
}
static __forceinline uint64_t cntlz64(uint64_t arg)
static force_inline uint64_t cntlz64(uint64_t arg)
{
#if defined(_MSC_VER)
unsigned long res;

View File

@ -129,8 +129,7 @@ static struct { inline operator Log::LogType() { return Log::LogType::TTY; } } T
void log_message(Log::LogType type, Log::LogSeverity sev, const char* text);
void log_message(Log::LogType type, Log::LogSeverity sev, std::string text);
template<typename... Targs>
__noinline void log_message(Log::LogType type, Log::LogSeverity sev, const char* fmt, Targs... args)
template<typename... Args> never_inline void log_message(Log::LogType type, Log::LogSeverity sev, const char* fmt, Args... args) printf_alike(3, 4)
{
log_message(type, sev, fmt::Format(fmt, fmt::do_unveil(args)...));
}

View File

@ -95,8 +95,7 @@ namespace fmt
T by_value(T x) { return x; }
//wrapper to deal with advance sprintf formating options with automatic length finding
template<typename ... Args>
std::string Format(const char* fmt, Args ... parameters)
template<typename... Args> std::string Format(const char* fmt, Args... parameters) printf_alike(1, 2)
{
size_t length = 256;
std::string str;
@ -139,7 +138,7 @@ namespace fmt
if (src.substr(pos, comp_length) == list[i].first)
{
src = (pos ? src.substr(0, pos) + list[i].second : list[i].second) + std::string(src.c_str() + pos + comp_length);
src = (pos ? src.substr(0, pos) + list[i].second : list[i].second) + src.substr(pos + comp_length);
pos += list[i].second.length() - 1;
break;
}
@ -163,7 +162,7 @@ namespace fmt
if (src.substr(pos, comp_length) == list[i].first)
{
src = (pos ? src.substr(0, pos) + list[i].second() : list[i].second()) + std::string(src.c_str() + pos + comp_length);
src = (pos ? src.substr(0, pos) + list[i].second() : list[i].second()) + src.substr(pos + comp_length);
pos += list[i].second().length() - 1;
break;
}
@ -182,7 +181,7 @@ namespace fmt
{
typedef T result_type;
__forceinline static result_type get_value(const T& arg)
force_inline static result_type get_value(const T& arg)
{
return arg;
}
@ -193,7 +192,7 @@ namespace fmt
{
typedef const char* result_type;
__forceinline static result_type get_value(const char* arg)
force_inline static result_type get_value(const char* arg)
{
return arg;
}
@ -204,7 +203,7 @@ namespace fmt
{
typedef const char* result_type;
__forceinline static result_type get_value(const char(&arg)[N])
force_inline static result_type get_value(const char(&arg)[N])
{
return arg;
}
@ -215,7 +214,7 @@ namespace fmt
{
typedef const char* result_type;
__forceinline static result_type get_value(const std::string& arg)
force_inline static result_type get_value(const std::string& arg)
{
return arg.c_str();
}
@ -226,7 +225,7 @@ namespace fmt
{
typedef typename std::underlying_type<T>::type result_type;
__forceinline static result_type get_value(const T& arg)
force_inline static result_type get_value(const T& arg)
{
return static_cast<result_type>(arg);
}
@ -237,14 +236,14 @@ namespace fmt
{
typedef typename unveil<T>::result_type result_type;
__forceinline static result_type get_value(const be_t<T, T2>& arg)
force_inline static result_type get_value(const be_t<T, T2>& arg)
{
return unveil<T>::get_value(arg.value());
}
};
template<typename T>
__forceinline typename unveil<T>::result_type do_unveil(const T& arg)
force_inline typename unveil<T>::result_type do_unveil(const T& arg)
{
return unveil<T>::get_value(arg);
}
@ -266,8 +265,7 @@ namespace fmt
vm::psv::ref (fmt::unveil) (vm_ref.h)
*/
template<typename... Args>
__forceinline __safebuffers std::string format(const char* fmt, Args... args)
template<typename... Args> force_inline safe_buffers std::string format(const char* fmt, Args... args) printf_alike(1, 2)
{
return Format(fmt, do_unveil(args)...);
}

View File

@ -118,7 +118,7 @@ struct waiter_map_t
bool is_stopped(u64 signal_id);
// wait until waiter_func() returns true, signal_id is an arbitrary number
template<typename S, typename WT> __forceinline __safebuffers void wait_op(const S& signal_id, const WT waiter_func)
template<typename S, typename WT> force_inline safe_buffers void wait_op(const S& signal_id, const WT waiter_func)
{
// generate hash
const auto hash = std::hash<S>()(signal_id) % size;
@ -141,7 +141,7 @@ struct waiter_map_t
}
// signal all threads waiting on waiter_op() with the same signal_id (signaling only hints those threads that corresponding conditions are *probably* met)
template<typename S> __forceinline void notify(const S& signal_id)
template<typename S> force_inline void notify(const S& signal_id)
{
// generate hash
const auto hash = std::hash<S>()(signal_id) % size;
@ -258,12 +258,12 @@ public:
return push(data, [do_exit](){ return do_exit && *do_exit; });
}
__forceinline bool push(const T& data)
force_inline bool push(const T& data)
{
return push(data, SQUEUE_NEVER_EXIT);
}
__forceinline bool try_push(const T& data)
force_inline bool try_push(const T& data)
{
return push(data, SQUEUE_ALWAYS_EXIT);
}
@ -326,12 +326,12 @@ public:
return pop(data, [do_exit](){ return do_exit && *do_exit; });
}
__forceinline bool pop(T& data)
force_inline bool pop(T& data)
{
return pop(data, SQUEUE_NEVER_EXIT);
}
__forceinline bool try_pop(T& data)
force_inline bool try_pop(T& data)
{
return pop(data, SQUEUE_ALWAYS_EXIT);
}
@ -388,12 +388,12 @@ public:
return peek(data, start_pos, [do_exit](){ return do_exit && *do_exit; });
}
__forceinline bool peek(T& data, u32 start_pos = 0)
force_inline bool peek(T& data, u32 start_pos = 0)
{
return peek(data, start_pos, SQUEUE_NEVER_EXIT);
}
__forceinline bool try_peek(T& data, u32 start_pos = 0)
force_inline bool try_peek(T& data, u32 start_pos = 0)
{
return peek(data, start_pos, SQUEUE_ALWAYS_EXIT);
}

View File

@ -13,121 +13,121 @@
#include <wx/zstream.h>
#pragma warning(pop)
__forceinline u8 Read8(vfsStream& f)
force_inline u8 Read8(vfsStream& f)
{
u8 ret;
f.Read(&ret, sizeof(ret));
return ret;
}
__forceinline u16 Read16(vfsStream& f)
force_inline u16 Read16(vfsStream& f)
{
be_t<u16> ret;
f.Read(&ret, sizeof(ret));
return ret;
}
__forceinline u32 Read32(vfsStream& f)
force_inline u32 Read32(vfsStream& f)
{
be_t<u32> ret;
f.Read(&ret, sizeof(ret));
return ret;
}
__forceinline u64 Read64(vfsStream& f)
force_inline u64 Read64(vfsStream& f)
{
be_t<u64> ret;
f.Read(&ret, sizeof(ret));
return ret;
}
__forceinline u16 Read16LE(vfsStream& f)
force_inline u16 Read16LE(vfsStream& f)
{
u16 ret;
f.Read(&ret, sizeof(ret));
return ret;
}
__forceinline u32 Read32LE(vfsStream& f)
force_inline u32 Read32LE(vfsStream& f)
{
u32 ret;
f.Read(&ret, sizeof(ret));
return ret;
}
__forceinline u64 Read64LE(vfsStream& f)
force_inline u64 Read64LE(vfsStream& f)
{
u64 ret;
f.Read(&ret, sizeof(ret));
return ret;
}
__forceinline void Write8(vfsStream& f, const u8 data)
force_inline void Write8(vfsStream& f, const u8 data)
{
f.Write(&data, sizeof(data));
}
__forceinline void Write8(const fs::file& f, const u8 data)
force_inline void Write8(const fs::file& f, const u8 data)
{
f.write(&data, sizeof(data));
}
__forceinline void Write16LE(vfsStream& f, const u16 data)
force_inline void Write16LE(vfsStream& f, const u16 data)
{
f.Write(&data, sizeof(data));
}
__forceinline void Write16LE(const fs::file& f, const u16 data)
force_inline void Write16LE(const fs::file& f, const u16 data)
{
f.write(&data, sizeof(data));
}
__forceinline void Write32LE(vfsStream& f, const u32 data)
force_inline void Write32LE(vfsStream& f, const u32 data)
{
f.Write(&data, sizeof(data));
}
__forceinline void Write32LE(const fs::file& f, const u32 data)
force_inline void Write32LE(const fs::file& f, const u32 data)
{
f.write(&data, sizeof(data));
}
__forceinline void Write64LE(vfsStream& f, const u64 data)
force_inline void Write64LE(vfsStream& f, const u64 data)
{
f.Write(&data, sizeof(data));
}
__forceinline void Write64LE(const fs::file& f, const u64 data)
force_inline void Write64LE(const fs::file& f, const u64 data)
{
f.write(&data, sizeof(data));
}
__forceinline void Write16(vfsStream& f, const u16 data)
force_inline void Write16(vfsStream& f, const u16 data)
{
Write16LE(f, re16(data));
}
__forceinline void Write16(const fs::file& f, const u16 data)
force_inline void Write16(const fs::file& f, const u16 data)
{
Write16LE(f, re16(data));
}
__forceinline void Write32(vfsStream& f, const u32 data)
force_inline void Write32(vfsStream& f, const u32 data)
{
Write32LE(f, re32(data));
}
__forceinline void Write32(const fs::file& f, const u32 data)
force_inline void Write32(const fs::file& f, const u32 data)
{
Write32LE(f, re32(data));
}
__forceinline void Write64(vfsStream& f, const u64 data)
force_inline void Write64(vfsStream& f, const u64 data)
{
Write64LE(f, re64(data));
}
__forceinline void Write64(const fs::file& f, const u64 data)
force_inline void Write64(const fs::file& f, const u64 data)
{
Write64LE(f, re64(data));
}

View File

@ -5,14 +5,14 @@
namespace vm
{
template<typename AT, typename RT, typename... T>
__forceinline RT _ptr_base<RT(T...), 1, AT>::operator()(ARMv7Context& context, T... args) const
force_inline RT _ptr_base<RT(T...), 1, AT>::operator()(ARMv7Context& context, T... args) const
{
return psv_func_detail::func_caller<RT, T...>::call(context, vm::cast(this->addr()), args...);
}
}
template<typename RT, typename... T>
__forceinline RT cb_call(ARMv7Context& context, u32 addr, T... args)
force_inline RT cb_call(ARMv7Context& context, u32 addr, T... args)
{
return psv_func_detail::func_caller<RT, T...>::call(context, addr, args...);
}

View File

@ -176,7 +176,7 @@ struct ARMv7Context
}
template<typename... T>
__noinline void fmt_debug_str(const char* fmt, T... args)
never_inline void fmt_debug_str(const char* fmt, T... args)
{
debug_str = fmt::format(fmt, args...);
}
@ -189,12 +189,12 @@ struct cast_armv7_gpr
typedef typename std::underlying_type<T>::type underlying_type;
__forceinline static u32 to_gpr(const T& value)
force_inline static u32 to_gpr(const T& value)
{
return cast_armv7_gpr<underlying_type>::to_gpr(static_cast<underlying_type>(value));
}
__forceinline static T from_gpr(const u32 reg)
force_inline static T from_gpr(const u32 reg)
{
return static_cast<T>(cast_armv7_gpr<underlying_type>::from_gpr(reg));
}
@ -203,12 +203,12 @@ struct cast_armv7_gpr
template<>
struct cast_armv7_gpr<u8, false>
{
__forceinline static u32 to_gpr(const u8& value)
force_inline static u32 to_gpr(const u8& value)
{
return value;
}
__forceinline static u8 from_gpr(const u32 reg)
force_inline static u8 from_gpr(const u32 reg)
{
return static_cast<u8>(reg);
}
@ -217,12 +217,12 @@ struct cast_armv7_gpr<u8, false>
template<>
struct cast_armv7_gpr<u16, false>
{
__forceinline static u32 to_gpr(const u16& value)
force_inline static u32 to_gpr(const u16& value)
{
return value;
}
__forceinline static u16 from_gpr(const u32 reg)
force_inline static u16 from_gpr(const u32 reg)
{
return static_cast<u16>(reg);
}
@ -231,12 +231,12 @@ struct cast_armv7_gpr<u16, false>
template<>
struct cast_armv7_gpr<u32, false>
{
__forceinline static u32 to_gpr(const u32& value)
force_inline static u32 to_gpr(const u32& value)
{
return value;
}
__forceinline static u32 from_gpr(const u32 reg)
force_inline static u32 from_gpr(const u32 reg)
{
return reg;
}
@ -245,12 +245,12 @@ struct cast_armv7_gpr<u32, false>
template<>
struct cast_armv7_gpr<s8, false>
{
__forceinline static u32 to_gpr(const s8& value)
force_inline static u32 to_gpr(const s8& value)
{
return value;
}
__forceinline static s8 from_gpr(const u32 reg)
force_inline static s8 from_gpr(const u32 reg)
{
return static_cast<s8>(reg);
}
@ -259,12 +259,12 @@ struct cast_armv7_gpr<s8, false>
template<>
struct cast_armv7_gpr<s16, false>
{
__forceinline static u32 to_gpr(const s16& value)
force_inline static u32 to_gpr(const s16& value)
{
return value;
}
__forceinline static s16 from_gpr(const u32 reg)
force_inline static s16 from_gpr(const u32 reg)
{
return static_cast<s16>(reg);
}
@ -273,12 +273,12 @@ struct cast_armv7_gpr<s16, false>
template<>
struct cast_armv7_gpr<s32, false>
{
__forceinline static u32 to_gpr(const s32& value)
force_inline static u32 to_gpr(const s32& value)
{
return value;
}
__forceinline static s32 from_gpr(const u32 reg)
force_inline static s32 from_gpr(const u32 reg)
{
return static_cast<s32>(reg);
}
@ -287,25 +287,25 @@ struct cast_armv7_gpr<s32, false>
template<>
struct cast_armv7_gpr<bool, false>
{
__forceinline static u32 to_gpr(const bool& value)
force_inline static u32 to_gpr(const bool& value)
{
return value;
}
__forceinline static bool from_gpr(const u32& reg)
force_inline static bool from_gpr(const u32& reg)
{
return reinterpret_cast<const bool&>(reg);
}
};
template<typename T>
__forceinline u32 cast_to_armv7_gpr(const T& value)
force_inline u32 cast_to_armv7_gpr(const T& value)
{
return cast_armv7_gpr<T>::to_gpr(value);
}
template<typename T>
__forceinline T cast_from_armv7_gpr(const u32 reg)
force_inline T cast_from_armv7_gpr(const u32 reg)
{
return cast_armv7_gpr<T>::from_gpr(reg);
}

View File

@ -56,12 +56,12 @@ namespace psv_func_detail
{
static_assert(sizeof(T) <= 4, "Invalid function argument type for ARG_GENERAL");
__forceinline static T get_arg(ARMv7Context& context)
force_inline static T get_arg(ARMv7Context& context)
{
return cast_from_armv7_gpr<T>(context.GPR[g_count - 1]);
}
__forceinline static void put_arg(ARMv7Context& context, const T& arg)
force_inline static void put_arg(ARMv7Context& context, const T& arg)
{
context.GPR[g_count - 1] = cast_to_armv7_gpr<T>(arg);
}
@ -73,12 +73,12 @@ namespace psv_func_detail
// first u64 argument is passed in r0-r1, second one is passed in r2-r3 (if g_count = 3)
static_assert(g_count == 1 || g_count == 3, "Wrong u64 argument position");
__forceinline static u64 get_arg(ARMv7Context& context)
force_inline static u64 get_arg(ARMv7Context& context)
{
return context.GPR_D[g_count >> 1];
}
__forceinline static void put_arg(ARMv7Context& context, u64 arg)
force_inline static void put_arg(ARMv7Context& context, u64 arg)
{
context.GPR_D[g_count >> 1] = arg;
}
@ -89,12 +89,12 @@ namespace psv_func_detail
{
static_assert(g_count == 1 || g_count == 3, "Wrong s64 argument position");
__forceinline static s64 get_arg(ARMv7Context& context)
force_inline static s64 get_arg(ARMv7Context& context)
{
return context.GPR_D[g_count >> 1];
}
__forceinline static void put_arg(ARMv7Context& context, s64 arg)
force_inline static void put_arg(ARMv7Context& context, s64 arg)
{
context.GPR_D[g_count >> 1] = arg;
}
@ -106,11 +106,11 @@ namespace psv_func_detail
static_assert(f_count <= 0, "TODO: Unsupported argument type (float)");
static_assert(sizeof(T) <= 8, "Invalid function argument type for ARG_FLOAT");
__forceinline static T get_arg(ARMv7Context& context)
force_inline static T get_arg(ARMv7Context& context)
{
}
__forceinline static void put_arg(ARMv7Context& context, const T& arg)
force_inline static void put_arg(ARMv7Context& context, const T& arg)
{
}
};
@ -121,11 +121,11 @@ namespace psv_func_detail
static_assert(v_count <= 0, "TODO: Unsupported argument type (vector)");
static_assert(std::is_same<T, u128>::value, "Invalid function argument type for ARG_VECTOR");
__forceinline static T get_arg(ARMv7Context& context)
force_inline static T get_arg(ARMv7Context& context)
{
}
__forceinline static void put_arg(ARMv7Context& context, const T& arg)
force_inline static void put_arg(ARMv7Context& context, const T& arg)
{
}
};
@ -137,13 +137,13 @@ namespace psv_func_detail
static_assert(v_count <= 0, "TODO: Unsupported stack argument type (vector)");
static_assert(sizeof(T) <= 4, "Invalid function argument type for ARG_STACK");
__forceinline static T get_arg(ARMv7Context& context)
force_inline static T get_arg(ARMv7Context& context)
{
// TODO: check
return cast_from_armv7_gpr<T>(vm::psv::read32(context.SP + sizeof(u32) * (g_count - 5)));
}
__forceinline static void put_arg(ARMv7Context& context, const T& arg)
force_inline static void put_arg(ARMv7Context& context, const T& arg)
{
// TODO: check
const int stack_pos = (g_count - 5) * 4 - FIXED_STACK_FRAME_SIZE;
@ -156,13 +156,13 @@ namespace psv_func_detail
template<int g_count, int f_count, int v_count>
struct bind_arg<u64, ARG_STACK, g_count, f_count, v_count>
{
__forceinline static u64 get_arg(ARMv7Context& context)
force_inline static u64 get_arg(ARMv7Context& context)
{
// TODO: check
return vm::psv::read64(context.SP + sizeof(u32) * (g_count - 5));
}
__forceinline static void put_arg(ARMv7Context& context, u64 arg)
force_inline static void put_arg(ARMv7Context& context, u64 arg)
{
// TODO: check
const int stack_pos = (g_count - 5) * 4 - FIXED_STACK_FRAME_SIZE;
@ -175,13 +175,13 @@ namespace psv_func_detail
template<int g_count, int f_count, int v_count>
struct bind_arg<s64, ARG_STACK, g_count, f_count, v_count>
{
__forceinline static s64 get_arg(ARMv7Context& context)
force_inline static s64 get_arg(ARMv7Context& context)
{
// TODO: check
return vm::psv::read64(context.SP + sizeof(u32) * (g_count - 5));
}
__forceinline static void put_arg(ARMv7Context& context, s64 arg)
force_inline static void put_arg(ARMv7Context& context, s64 arg)
{
// TODO: check
const int stack_pos = (g_count - 5) * 4 - FIXED_STACK_FRAME_SIZE;
@ -199,12 +199,12 @@ namespace psv_func_detail
static_assert(type == ARG_GENERAL, "Wrong use of bind_result template");
static_assert(sizeof(T) <= 4, "Invalid function result type for ARG_GENERAL");
__forceinline static T get_result(ARMv7Context& context)
force_inline static T get_result(ARMv7Context& context)
{
return cast_from_armv7_gpr<T>(context.GPR[0]);
}
__forceinline static void put_result(ARMv7Context& context, const T& result)
force_inline static void put_result(ARMv7Context& context, const T& result)
{
context.GPR[0] = cast_to_armv7_gpr<T>(result);
}
@ -213,12 +213,12 @@ namespace psv_func_detail
template<>
struct bind_result<u64, ARG_GENERAL>
{
__forceinline static u64 get_result(ARMv7Context& context)
force_inline static u64 get_result(ARMv7Context& context)
{
return context.GPR_D[0];
}
__forceinline static void put_result(ARMv7Context& context, u64 result)
force_inline static void put_result(ARMv7Context& context, u64 result)
{
context.GPR_D[0] = result;
}
@ -227,12 +227,12 @@ namespace psv_func_detail
template<>
struct bind_result<s64, ARG_GENERAL>
{
__forceinline static s64 get_result(ARMv7Context& context)
force_inline static s64 get_result(ARMv7Context& context)
{
return context.GPR_D[0];
}
__forceinline static void put_result(ARMv7Context& context, s64 result)
force_inline static void put_result(ARMv7Context& context, s64 result)
{
context.GPR_D[0] = result;
}
@ -243,7 +243,7 @@ namespace psv_func_detail
//{
// static_assert(sizeof(T) <= 8, "Invalid function result type for ARG_FLOAT");
// static __forceinline void put_result(ARMv7Context& context, const T& result)
// static force_inline void put_result(ARMv7Context& context, const T& result)
// {
// }
//};
@ -253,7 +253,7 @@ namespace psv_func_detail
//{
// static_assert(std::is_same<T, u128>::value, "Invalid function result type for ARG_VECTOR");
// static __forceinline void put_result(ARMv7Context& context, const T& result)
// static force_inline void put_result(ARMv7Context& context, const T& result)
// {
// }
//};
@ -289,7 +289,7 @@ namespace psv_func_detail
template <typename RT, typename F, typename Tuple, bool Done, int Total, int... N>
struct call_impl
{
static __forceinline RT call(F f, Tuple && t)
static force_inline RT call(F f, Tuple && t)
{
return call_impl<RT, F, Tuple, Total == 1 + sizeof...(N), Total, N..., sizeof...(N)>::call(f, std::forward<Tuple>(t));
}
@ -298,28 +298,28 @@ namespace psv_func_detail
template <typename RT, typename F, typename Tuple, int Total, int... N>
struct call_impl<RT, F, Tuple, true, Total, N...>
{
static __forceinline RT call(F f, Tuple && t)
static force_inline RT call(F f, Tuple && t)
{
return f(std::get<N>(std::forward<Tuple>(t))...);
}
};
template <typename RT, typename F, typename Tuple>
__forceinline RT call(F f, Tuple && t)
force_inline RT call(F f, Tuple && t)
{
typedef typename std::decay<Tuple>::type ttype;
return psv_func_detail::call_impl<RT, F, Tuple, 0 == std::tuple_size<ttype>::value, std::tuple_size<ttype>::value>::call(f, std::forward<Tuple>(t));
}
template<int g_count, int f_count, int v_count>
__forceinline std::tuple<> get_func_args(ARMv7Context& context)
force_inline std::tuple<> get_func_args(ARMv7Context& context)
{
// terminator
return std::tuple<>();
}
template<int g_count, int f_count, int v_count, typename T, typename... A>
__forceinline std::tuple<T, A...> get_func_args(ARMv7Context& context)
force_inline std::tuple<T, A...> get_func_args(ARMv7Context& context)
{
typedef arg_type<T, g_count, f_count, v_count> type;
const arg_class t = type::value;
@ -332,14 +332,14 @@ namespace psv_func_detail
}
template<int g_count, int f_count, int v_count>
__forceinline static bool put_func_args(ARMv7Context& context)
force_inline static bool put_func_args(ARMv7Context& context)
{
// terminator
return false;
}
template<int g_count, int f_count, int v_count, typename T1, typename... T>
__forceinline static bool put_func_args(ARMv7Context& context, T1 arg, T... args)
force_inline static bool put_func_args(ARMv7Context& context, T1 arg, T... args)
{
typedef arg_type<T1, g_count, f_count, v_count> type;
const arg_class t = type::value;
@ -404,7 +404,7 @@ namespace psv_func_detail
template<typename RT, typename... T>
struct func_caller
{
__forceinline static RT call(ARMv7Context& context, u32 addr, T... args)
force_inline static RT call(ARMv7Context& context, u32 addr, T... args)
{
func_caller<void, T...>::call(context, addr, args...);
@ -415,7 +415,7 @@ namespace psv_func_detail
template<typename... T>
struct func_caller<void, T...>
{
__forceinline static void call(ARMv7Context& context, u32 addr, T... args)
force_inline static void call(ARMv7Context& context, u32 addr, T... args)
{
if (put_func_args<0, 0, 0, T...>(context, args...))
{
@ -464,7 +464,7 @@ enum psv_special_function_index : u16
// Do not call directly
u32 add_psv_func(psv_func data);
// Do not call directly
template<typename RT, typename... T> __forceinline void call_psv_func(ARMv7Context& context, RT(*func)(T...))
template<typename RT, typename... T> force_inline void call_psv_func(ARMv7Context& context, RT(*func)(T...))
{
psv_func_detail::func_binder<RT, T...>::do_call(context, func);
}

View File

@ -354,17 +354,17 @@ public:
}
}
__forceinline const std::string& GetName() const
force_inline const std::string& GetName() const
{
return m_name;
}
__forceinline const uint GetArgCount() const
force_inline const uint GetArgCount() const
{
return m_args_count;
}
__forceinline const CodeFieldBase& GetArg(uint index) const
force_inline const CodeFieldBase& GetArg(uint index) const
{
assert(index < m_args_count);
return *m_args[index];

View File

@ -1,6 +1,6 @@
#pragma once
template<uint size, typename T> __forceinline static T sign(const T value)
template<uint size, typename T> force_inline static T sign(const T value)
{
static_assert(size > 0 && size < sizeof(T) * 8, "Bad sign size");

View File

@ -26,13 +26,13 @@ public:
static const u32 shift = 31 - to;
static const u32 mask = ((1ULL << ((to - from) + 1)) - 1) << shift;
static __forceinline void encode(u32& data, u32 value)
static force_inline void encode(u32& data, u32 value)
{
data &= ~mask;
data |= (value << shift) & mask;
}
static __forceinline u32 decode(u32 data)
static force_inline u32 decode(u32 data)
{
return (data & mask) >> shift;
}
@ -64,13 +64,13 @@ public:
static const u32 shift2 = 31 - to2;
static const u32 mask2 = ((1 << ((to2 - from2) + 1)) - 1) << shift2;
static __forceinline void encode(u32& data, u32 value)
static force_inline void encode(u32& data, u32 value)
{
data &= ~(CodeField<from1, to1>::mask | mask2);
data |= ((value << CodeField<from1, to1>::shift) & CodeField<from1, to1>::mask) | (((value >> offset) << shift2) & mask2);
}
static __forceinline u32 decode(u32 data)
static force_inline u32 decode(u32 data)
{
return ((data & CodeField<from1, to1>::mask) >> CodeField<from1, to1>::shift) | (((data & mask2) >> shift2) << offset);
}
@ -96,7 +96,7 @@ public:
static const int size = _size;
static __forceinline u32 decode(u32 data)
static force_inline u32 decode(u32 data)
{
return sign<size>((data & CodeField<from, to>::mask) >> CodeField<from, to>::shift);
}
@ -117,12 +117,12 @@ public:
{
}
static __forceinline u32 decode(u32 data)
static force_inline u32 decode(u32 data)
{
return ((data & CodeField<from, to>::mask) >> CodeField<from, to>::shift) << offset;
}
static __forceinline void encode(u32& data, u32 value)
static force_inline void encode(u32& data, u32 value)
{
data &= ~CodeField<from, to>::mask;
data |= ((value >> offset) << CodeField<from, to>::shift) & CodeField<from, to>::mask;
@ -149,12 +149,12 @@ public:
{
}
static __forceinline u32 decode(u32 data)
static force_inline u32 decode(u32 data)
{
return sign<size>((data & CodeField<from, to>::mask) >> CodeField<from, to>::shift) << offset;
}
static __forceinline void encode(u32& data, u32 value)
static force_inline void encode(u32& data, u32 value)
{
data &= ~CodeField<from, to>::mask;
data |= ((value >> offset) << CodeField<from, to>::shift) & CodeField<from, to>::mask;

View File

@ -24,7 +24,7 @@ public:
}
}
__forceinline __m128 operator [] (s32 scale) const
force_inline __m128 operator [] (s32 scale) const
{
return m_data[scale + 31];
}

View File

@ -847,12 +847,12 @@ struct cast_ppu_gpr
typedef typename std::underlying_type<T>::type underlying_type;
__forceinline static u64 to_gpr(const T& value)
force_inline static u64 to_gpr(const T& value)
{
return cast_ppu_gpr<underlying_type>::to_gpr(static_cast<underlying_type>(value));
}
__forceinline static T from_gpr(const u64 reg)
force_inline static T from_gpr(const u64 reg)
{
return static_cast<T>(cast_ppu_gpr<underlying_type>::from_gpr(reg));
}
@ -861,12 +861,12 @@ struct cast_ppu_gpr
template<>
struct cast_ppu_gpr<u8, false>
{
__forceinline static u64 to_gpr(const u8& value)
force_inline static u64 to_gpr(const u8& value)
{
return value;
}
__forceinline static u8 from_gpr(const u64 reg)
force_inline static u8 from_gpr(const u64 reg)
{
return static_cast<u8>(reg);
}
@ -875,12 +875,12 @@ struct cast_ppu_gpr<u8, false>
template<>
struct cast_ppu_gpr<u16, false>
{
__forceinline static u64 to_gpr(const u16& value)
force_inline static u64 to_gpr(const u16& value)
{
return value;
}
__forceinline static u16 from_gpr(const u64 reg)
force_inline static u16 from_gpr(const u64 reg)
{
return static_cast<u16>(reg);
}
@ -889,12 +889,12 @@ struct cast_ppu_gpr<u16, false>
template<>
struct cast_ppu_gpr<u32, false>
{
__forceinline static u64 to_gpr(const u32& value)
force_inline static u64 to_gpr(const u32& value)
{
return value;
}
__forceinline static u32 from_gpr(const u64 reg)
force_inline static u32 from_gpr(const u64 reg)
{
return static_cast<u32>(reg);
}
@ -904,12 +904,12 @@ struct cast_ppu_gpr<u32, false>
template<>
struct cast_ppu_gpr<unsigned long, false>
{
__forceinline static u64 to_gpr(const unsigned long& value)
force_inline static u64 to_gpr(const unsigned long& value)
{
return value;
}
__forceinline static unsigned long from_gpr(const u64 reg)
force_inline static unsigned long from_gpr(const u64 reg)
{
return static_cast<unsigned long>(reg);
}
@ -919,12 +919,12 @@ struct cast_ppu_gpr<unsigned long, false>
template<>
struct cast_ppu_gpr<u64, false>
{
__forceinline static u64 to_gpr(const u64& value)
force_inline static u64 to_gpr(const u64& value)
{
return value;
}
__forceinline static u64 from_gpr(const u64 reg)
force_inline static u64 from_gpr(const u64 reg)
{
return reg;
}
@ -933,12 +933,12 @@ struct cast_ppu_gpr<u64, false>
template<>
struct cast_ppu_gpr<s8, false>
{
__forceinline static u64 to_gpr(const s8& value)
force_inline static u64 to_gpr(const s8& value)
{
return value;
}
__forceinline static s8 from_gpr(const u64 reg)
force_inline static s8 from_gpr(const u64 reg)
{
return static_cast<s8>(reg);
}
@ -947,12 +947,12 @@ struct cast_ppu_gpr<s8, false>
template<>
struct cast_ppu_gpr<s16, false>
{
__forceinline static u64 to_gpr(const s16& value)
force_inline static u64 to_gpr(const s16& value)
{
return value;
}
__forceinline static s16 from_gpr(const u64 reg)
force_inline static s16 from_gpr(const u64 reg)
{
return static_cast<s16>(reg);
}
@ -961,12 +961,12 @@ struct cast_ppu_gpr<s16, false>
template<>
struct cast_ppu_gpr<s32, false>
{
__forceinline static u64 to_gpr(const s32& value)
force_inline static u64 to_gpr(const s32& value)
{
return value;
}
__forceinline static s32 from_gpr(const u64 reg)
force_inline static s32 from_gpr(const u64 reg)
{
return static_cast<s32>(reg);
}
@ -975,12 +975,12 @@ struct cast_ppu_gpr<s32, false>
template<>
struct cast_ppu_gpr<s64, false>
{
__forceinline static u64 to_gpr(const s64& value)
force_inline static u64 to_gpr(const s64& value)
{
return value;
}
__forceinline static s64 from_gpr(const u64 reg)
force_inline static s64 from_gpr(const u64 reg)
{
return static_cast<s64>(reg);
}
@ -989,25 +989,25 @@ struct cast_ppu_gpr<s64, false>
template<>
struct cast_ppu_gpr<bool, false>
{
__forceinline static u64 to_gpr(const bool& value)
force_inline static u64 to_gpr(const bool& value)
{
return value;
}
__forceinline static bool from_gpr(const u64& reg)
force_inline static bool from_gpr(const u64& reg)
{
return reinterpret_cast<const bool&>(reg);
}
};
template<typename T>
__forceinline u64 cast_to_ppu_gpr(const T& value)
force_inline u64 cast_to_ppu_gpr(const T& value)
{
return cast_ppu_gpr<T>::to_gpr(value);
}
template<typename T>
__forceinline T cast_from_ppu_gpr(const u64 reg)
force_inline T cast_from_ppu_gpr(const u64 reg)
{
return cast_ppu_gpr<T>::from_gpr(reg);
}

View File

@ -9,7 +9,7 @@ enum : u32
RAW_SPU_PROB_OFFSET = 0x00040000,
};
__forceinline static u32 GetRawSPURegAddrByNum(int num, int offset)
force_inline static u32 GetRawSPURegAddrByNum(int num, int offset)
{
return RAW_SPU_OFFSET * num + RAW_SPU_BASE_ADDR + RAW_SPU_PROB_OFFSET + offset;
}

View File

@ -50,7 +50,7 @@ public:
}
}
__forceinline spu_inter_func_t operator [] (u32 opcode) const
force_inline spu_inter_func_t operator [] (u32 opcode) const
{
return funcs[opcode >> 21];
}

View File

@ -338,7 +338,7 @@ struct g_spu_imm_table_t
}
}
__forceinline __m128 operator [] (s32 scale) const
force_inline __m128 operator [] (s32 scale) const
{
return m_data[scale + 155];
}

View File

@ -19,14 +19,14 @@ struct vfsStream
virtual u64 Write(const void* src, u64 count) = 0;
template<typename T> __forceinline bool SWrite(const T& data, u64 count = sizeof(T))
template<typename T> force_inline bool SWrite(const T& data, u64 count = sizeof(T))
{
return Write(&data, count) == count;
}
virtual u64 Read(void* dst, u64 count) = 0;
template<typename T> __forceinline bool SRead(T& data, u64 count = sizeof(T))
template<typename T> force_inline bool SRead(T& data, u64 count = sizeof(T))
{
return Read(&data, count) == count;
}

View File

@ -82,7 +82,7 @@ class vfsHDDFile
void WriteEntry(u64 block, const vfsHDD_Entry& data, const std::string& name);
__forceinline u32 GetMaxNameLen() const
force_inline u32 GetMaxNameLen() const
{
return m_hdd_info.block_size - sizeof(vfsHDD_Entry);
}
@ -149,7 +149,7 @@ class vfsHDD : public vfsFileBase
public:
vfsHDD(vfsDevice* device, const std::string& hdd_path);
__forceinline u32 GetMaxNameLen() const
force_inline u32 GetMaxNameLen() const
{
return m_hdd_info.block_size - sizeof(vfsHDD_Entry);
}

View File

@ -45,62 +45,62 @@ union _atomic_base
type data; // unsafe direct access
subtype sub_data; // unsafe direct access to substitute type
__forceinline static const subtype to_subtype(const type& value)
force_inline static const subtype to_subtype(const type& value)
{
return reinterpret_cast<const subtype&>(value);
}
__forceinline static const type from_subtype(const subtype value)
force_inline static const type from_subtype(const subtype value)
{
return reinterpret_cast<const type&>(value);
}
__forceinline static type& to_type(subtype& value)
force_inline static type& to_type(subtype& value)
{
return reinterpret_cast<type&>(value);
}
public:
// atomically compare data with cmp, replace with exch if equal, return previous data value anyway
__forceinline const type compare_and_swap(const type& cmp, const type& exch) volatile
force_inline const type compare_and_swap(const type& cmp, const type& exch) volatile
{
return from_subtype(sync_val_compare_and_swap(&sub_data, to_subtype(cmp), to_subtype(exch)));
}
// atomically compare data with cmp, replace with exch if equal, return true if data was replaced
__forceinline bool compare_and_swap_test(const type& cmp, const type& exch) volatile
force_inline bool compare_and_swap_test(const type& cmp, const type& exch) volatile
{
return sync_bool_compare_and_swap(&sub_data, to_subtype(cmp), to_subtype(exch));
}
// read data with memory barrier
__forceinline const type read_sync() const volatile
force_inline const type read_sync() const volatile
{
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
__forceinline const type exchange(const type& exch) volatile
force_inline const type exchange(const type& exch) volatile
{
return from_subtype(sync_lock_test_and_set(&sub_data, to_subtype(exch)));
}
// read data without memory barrier
__forceinline const type read_relaxed() const volatile
force_inline const type read_relaxed() const volatile
{
const subtype value = const_cast<const subtype&>(sub_data);
return from_subtype(value);
}
// write data without memory barrier
__forceinline void write_relaxed(const type& value) volatile
force_inline void write_relaxed(const type& value) volatile
{
const_cast<subtype&>(sub_data) = to_subtype(value);
}
// perform atomic operation on data
template<typename FT> __forceinline void atomic_op(const FT atomic_proc) volatile
template<typename FT> force_inline void atomic_op(const FT atomic_proc) volatile
{
while (true)
{
@ -112,7 +112,7 @@ public:
}
// perform atomic operation on data with special exit condition (if intermediate result != proceed_value)
template<typename RT, typename FT> __forceinline RT atomic_op(const RT proceed_value, const FT atomic_proc) volatile
template<typename RT, typename FT> force_inline RT atomic_op(const RT proceed_value, const FT atomic_proc) volatile
{
while (true)
{
@ -125,7 +125,7 @@ public:
}
// 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> force_inline void atomic_op_sync(const FT atomic_proc) volatile
{
const subtype zero = {};
subtype old = sync_val_compare_and_swap(&sub_data, zero, zero);
@ -140,7 +140,7 @@ public:
}
// 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> force_inline RT atomic_op_sync(const RT proceed_value, const FT atomic_proc) volatile
{
const subtype zero = {};
subtype old = sync_val_compare_and_swap(&sub_data, zero, zero);
@ -156,40 +156,40 @@ public:
}
// atomic bitwise OR, returns previous data
__forceinline const type _or(const type& right) volatile
force_inline const type _or(const type& right) volatile
{
return from_subtype(sync_fetch_and_or(&sub_data, to_subtype(right)));
}
// atomic bitwise AND, returns previous data
__forceinline const type _and(const type& right) volatile
force_inline const type _and(const type& right) volatile
{
return from_subtype(sync_fetch_and_and(&sub_data, to_subtype(right)));
}
// atomic bitwise AND NOT (inverts right argument), returns previous data
__forceinline const type _and_not(const type& right) volatile
force_inline const type _and_not(const type& right) volatile
{
return from_subtype(sync_fetch_and_and(&sub_data, ~to_subtype(right)));
}
// atomic bitwise XOR, returns previous data
__forceinline const type _xor(const type& right) volatile
force_inline const type _xor(const type& right) volatile
{
return from_subtype(sync_fetch_and_xor(&sub_data, to_subtype(right)));
}
__forceinline const type operator |= (const type& right) volatile
force_inline const type operator |= (const type& right) volatile
{
return from_subtype(sync_fetch_and_or(&sub_data, to_subtype(right)) | to_subtype(right));
}
__forceinline const type operator &= (const type& right) volatile
force_inline const type operator &= (const type& right) volatile
{
return from_subtype(sync_fetch_and_and(&sub_data, to_subtype(right)) & to_subtype(right));
}
__forceinline const type operator ^= (const type& right) volatile
force_inline const type operator ^= (const type& right) volatile
{
return from_subtype(sync_fetch_and_xor(&sub_data, to_subtype(right)) ^ to_subtype(right));
}

View File

@ -91,7 +91,7 @@ namespace vm
bool do_notify;
__noinline void lock()
never_inline void lock()
{
NamedThreadBase* owner = GetCurrentNamedThread();
NamedThreadBase* old = nullptr;
@ -113,7 +113,7 @@ namespace vm
do_notify = true;
}
__noinline void unlock()
never_inline void unlock()
{
NamedThreadBase* owner = GetCurrentNamedThread();

View File

@ -90,14 +90,14 @@ namespace vm
u32 get_addr(const void* real_pointer);
__noinline void error(const u64 addr, const char* func);
never_inline void error(const u64 addr, const char* func);
template<typename T>
struct cast_ptr
{
static_assert(std::is_same<T, u32>::value, "Unsupported vm::cast() type");
__forceinline static u32 cast(const T& addr, const char* func)
force_inline static u32 cast(const T& addr, const char* func)
{
return 0;
}
@ -106,7 +106,7 @@ namespace vm
template<>
struct cast_ptr<u32>
{
__forceinline static u32 cast(const u32 addr, const char* func)
force_inline static u32 cast(const u32 addr, const char* func)
{
return addr;
}
@ -115,7 +115,7 @@ namespace vm
template<>
struct cast_ptr<u64>
{
__forceinline static u32 cast(const u64 addr, const char* func)
force_inline static u32 cast(const u64 addr, const char* func)
{
const u32 res = static_cast<u32>(addr);
if (res != addr)
@ -130,14 +130,14 @@ namespace vm
template<typename T, typename T2>
struct cast_ptr<be_t<T, T2>>
{
__forceinline static u32 cast(const be_t<T, T2>& addr, const char* func)
force_inline static u32 cast(const be_t<T, T2>& addr, const char* func)
{
return cast_ptr<T>::cast(addr.value(), func);
}
};
template<typename T>
__forceinline static u32 cast(const T& addr, const char* func = "vm::cast")
force_inline static u32 cast(const T& addr, const char* func = "vm::cast")
{
return cast_ptr<T>::cast(addr, func);
}

View File

@ -56,22 +56,22 @@ namespace vm
_ptr_base operator - (typename remove_be_t<AT>::type count) const { return make(m_addr - count * address_size); }
_ptr_base operator - (typename to_be_t<AT>::type count) const { return make(m_addr - count * address_size); }
__forceinline bool operator <(const _ptr_base& right) const { return m_addr < right.m_addr; }
__forceinline bool operator <=(const _ptr_base& right) const { return m_addr <= right.m_addr; }
__forceinline bool operator >(const _ptr_base& right) const { return m_addr > right.m_addr; }
__forceinline bool operator >=(const _ptr_base& right) const { return m_addr >= right.m_addr; }
__forceinline bool operator ==(const _ptr_base& right) const { return m_addr == right.m_addr; }
__forceinline bool operator !=(const _ptr_base& right) const { return m_addr != right.m_addr; }
__forceinline bool operator ==(const nullptr_t& right) const { return m_addr == 0; }
__forceinline bool operator !=(const nullptr_t& right) const { return m_addr != 0; }
force_inline bool operator <(const _ptr_base& right) const { return m_addr < right.m_addr; }
force_inline bool operator <=(const _ptr_base& right) const { return m_addr <= right.m_addr; }
force_inline bool operator >(const _ptr_base& right) const { return m_addr > right.m_addr; }
force_inline bool operator >=(const _ptr_base& right) const { return m_addr >= right.m_addr; }
force_inline bool operator ==(const _ptr_base& right) const { return m_addr == right.m_addr; }
force_inline bool operator !=(const _ptr_base& right) const { return m_addr != right.m_addr; }
force_inline bool operator ==(const nullptr_t& right) const { return m_addr == 0; }
force_inline bool operator !=(const nullptr_t& right) const { return m_addr != 0; }
explicit operator bool() const { return m_addr != 0; }
__forceinline _ptr_base<T, lvl - 1, std::conditional<is_be_t<T>::value, typename to_be_t<AT>::type, AT>>& operator *() const
force_inline _ptr_base<T, lvl - 1, std::conditional<is_be_t<T>::value, typename to_be_t<AT>::type, AT>>& operator *() const
{
return vm::get_ref<_ptr_base<T, lvl - 1, std::conditional<is_be_t<T>::value, typename to_be_t<AT>::type, AT>>>(vm::cast(m_addr));
}
__forceinline _ptr_base<T, lvl - 1, std::conditional<is_be_t<T>::value, typename to_be_t<AT>::type, AT>>& operator [](AT index) const
force_inline _ptr_base<T, lvl - 1, std::conditional<is_be_t<T>::value, typename to_be_t<AT>::type, AT>>& operator [](AT index) const
{
return vm::get_ref<_ptr_base<T, lvl - 1, std::conditional<is_be_t<T>::value, typename to_be_t<AT>::type, AT>>>(vm::cast(m_addr + sizeof(AT)* index));
}
@ -110,12 +110,12 @@ namespace vm
static_assert(!std::is_reference<T>::value, "vm::_ptr_base<> error: invalid type (reference)");
typedef typename std::remove_cv<T>::type type;
__forceinline static const u32 data_size()
force_inline static const u32 data_size()
{
return sizeof(T);
}
__forceinline T* const operator -> () const
force_inline T* const operator -> () const
{
return vm::get_ptr<T>(vm::cast(m_addr));
}
@ -163,29 +163,29 @@ namespace vm
_ptr_base operator - (typename remove_be_t<AT>::type count) const { return make(m_addr - count * data_size()); }
_ptr_base operator - (typename to_be_t<AT>::type count) const { return make(m_addr - count * data_size()); }
__forceinline T& operator *() const
force_inline T& operator *() const
{
return vm::get_ref<T>(vm::cast(m_addr));
}
__forceinline T& operator [](typename remove_be_t<AT>::type index) const
force_inline T& operator [](typename remove_be_t<AT>::type index) const
{
return vm::get_ref<T>(vm::cast(m_addr + data_size() * index));
}
__forceinline T& operator [](typename to_be_t<AT>::forced_type index) const
force_inline T& operator [](typename to_be_t<AT>::forced_type index) const
{
return vm::get_ref<T>(vm::cast(m_addr + data_size() * index));
}
__forceinline bool operator <(const _ptr_base& right) const { return m_addr < right.m_addr; }
__forceinline bool operator <=(const _ptr_base& right) const { return m_addr <= right.m_addr; }
__forceinline bool operator >(const _ptr_base& right) const { return m_addr > right.m_addr; }
__forceinline bool operator >=(const _ptr_base& right) const { return m_addr >= right.m_addr; }
__forceinline bool operator ==(const _ptr_base& right) const { return m_addr == right.m_addr; }
__forceinline bool operator !=(const _ptr_base& right) const { return m_addr != right.m_addr; }
__forceinline bool operator ==(const nullptr_t& right) const { return m_addr == 0; }
__forceinline bool operator !=(const nullptr_t& right) const { return m_addr != 0; }
force_inline bool operator <(const _ptr_base& right) const { return m_addr < right.m_addr; }
force_inline bool operator <=(const _ptr_base& right) const { return m_addr <= right.m_addr; }
force_inline bool operator >(const _ptr_base& right) const { return m_addr > right.m_addr; }
force_inline bool operator >=(const _ptr_base& right) const { return m_addr >= right.m_addr; }
force_inline bool operator ==(const _ptr_base& right) const { return m_addr == right.m_addr; }
force_inline bool operator !=(const _ptr_base& right) const { return m_addr != right.m_addr; }
force_inline bool operator ==(const nullptr_t& right) const { return m_addr == 0; }
force_inline bool operator !=(const nullptr_t& right) const { return m_addr != 0; }
explicit operator bool() const { return m_addr != 0; }
explicit operator T*() const { return get_ptr(); }
@ -255,14 +255,14 @@ namespace vm
return get_ptr();
}
__forceinline bool operator <(const _ptr_base& right) const { return m_addr < right.m_addr; }
__forceinline bool operator <=(const _ptr_base& right) const { return m_addr <= right.m_addr; }
__forceinline bool operator >(const _ptr_base& right) const { return m_addr > right.m_addr; }
__forceinline bool operator >=(const _ptr_base& right) const { return m_addr >= right.m_addr; }
__forceinline bool operator ==(const _ptr_base& right) const { return m_addr == right.m_addr; }
__forceinline bool operator !=(const _ptr_base& right) const { return m_addr != right.m_addr; }
__forceinline bool operator ==(const nullptr_t& right) const { return m_addr == 0; }
__forceinline bool operator !=(const nullptr_t& right) const { return m_addr != 0; }
force_inline bool operator <(const _ptr_base& right) const { return m_addr < right.m_addr; }
force_inline bool operator <=(const _ptr_base& right) const { return m_addr <= right.m_addr; }
force_inline bool operator >(const _ptr_base& right) const { return m_addr > right.m_addr; }
force_inline bool operator >=(const _ptr_base& right) const { return m_addr >= right.m_addr; }
force_inline bool operator ==(const _ptr_base& right) const { return m_addr == right.m_addr; }
force_inline bool operator !=(const _ptr_base& right) const { return m_addr != right.m_addr; }
force_inline bool operator ==(const nullptr_t& right) const { return m_addr == 0; }
force_inline bool operator !=(const nullptr_t& right) const { return m_addr != 0; }
explicit operator bool() const { return m_addr != 0; }
template<typename AT2>
@ -317,14 +317,14 @@ namespace vm
return get_ptr();
}
__forceinline bool operator <(const _ptr_base& right) const { return m_addr < right.m_addr; }
__forceinline bool operator <=(const _ptr_base& right) const { return m_addr <= right.m_addr; }
__forceinline bool operator >(const _ptr_base& right) const { return m_addr > right.m_addr; }
__forceinline bool operator >=(const _ptr_base& right) const { return m_addr >= right.m_addr; }
__forceinline bool operator ==(const _ptr_base& right) const { return m_addr == right.m_addr; }
__forceinline bool operator !=(const _ptr_base& right) const { return m_addr != right.m_addr; }
__forceinline bool operator ==(const nullptr_t& right) const { return m_addr == 0; }
__forceinline bool operator !=(const nullptr_t& right) const { return m_addr != 0; }
force_inline bool operator <(const _ptr_base& right) const { return m_addr < right.m_addr; }
force_inline bool operator <=(const _ptr_base& right) const { return m_addr <= right.m_addr; }
force_inline bool operator >(const _ptr_base& right) const { return m_addr > right.m_addr; }
force_inline bool operator >=(const _ptr_base& right) const { return m_addr >= right.m_addr; }
force_inline bool operator ==(const _ptr_base& right) const { return m_addr == right.m_addr; }
force_inline bool operator !=(const _ptr_base& right) const { return m_addr != right.m_addr; }
force_inline bool operator ==(const nullptr_t& right) const { return m_addr == 0; }
force_inline bool operator !=(const nullptr_t& right) const { return m_addr != 0; }
explicit operator bool() const { return m_addr != 0; }
template<typename AT2>
@ -365,14 +365,14 @@ namespace vm
m_addr = value;
}
__forceinline bool operator <(const _ptr_base& right) const { return m_addr < right.m_addr; }
__forceinline bool operator <=(const _ptr_base& right) const { return m_addr <= right.m_addr; }
__forceinline bool operator >(const _ptr_base& right) const { return m_addr > right.m_addr; }
__forceinline bool operator >=(const _ptr_base& right) const { return m_addr >= right.m_addr; }
__forceinline bool operator ==(const _ptr_base& right) const { return m_addr == right.m_addr; }
__forceinline bool operator !=(const _ptr_base& right) const { return m_addr != right.m_addr; }
__forceinline bool operator ==(const nullptr_t& right) const { return m_addr == 0; }
__forceinline bool operator !=(const nullptr_t& right) const { return m_addr != 0; }
force_inline bool operator <(const _ptr_base& right) const { return m_addr < right.m_addr; }
force_inline bool operator <=(const _ptr_base& right) const { return m_addr <= right.m_addr; }
force_inline bool operator >(const _ptr_base& right) const { return m_addr > right.m_addr; }
force_inline bool operator >=(const _ptr_base& right) const { return m_addr >= right.m_addr; }
force_inline bool operator ==(const _ptr_base& right) const { return m_addr == right.m_addr; }
force_inline bool operator !=(const _ptr_base& right) const { return m_addr != right.m_addr; }
force_inline bool operator ==(const nullptr_t& right) const { return m_addr == 0; }
force_inline bool operator !=(const nullptr_t& right) const { return m_addr != 0; }
explicit operator bool() const { return m_addr != 0; }
template<typename AT2>
@ -465,7 +465,7 @@ namespace fmt
{
typedef typename unveil<AT>::result_type result_type;
__forceinline static result_type get_value(const vm::_ptr_base<T, lvl, AT>& arg)
force_inline static result_type get_value(const vm::_ptr_base<T, lvl, AT>& arg)
{
return unveil<AT>::get_value(arg.addr());
}
@ -480,12 +480,12 @@ struct cast_ppu_gpr;
template<typename T, int lvl, typename AT>
struct cast_ppu_gpr<vm::_ptr_base<T, lvl, AT>, false>
{
__forceinline static u64 to_gpr(const vm::_ptr_base<T, lvl, AT>& value)
force_inline static u64 to_gpr(const vm::_ptr_base<T, lvl, AT>& value)
{
return cast_ppu_gpr<AT, std::is_enum<AT>::value>::to_gpr(value.addr());
}
__forceinline static vm::_ptr_base<T, lvl, AT> from_gpr(const u64 reg)
force_inline static vm::_ptr_base<T, lvl, AT> from_gpr(const u64 reg)
{
return vm::_ptr_base<T, lvl, AT>::make(cast_ppu_gpr<AT, std::is_enum<AT>::value>::from_gpr(reg));
}
@ -499,12 +499,12 @@ struct cast_armv7_gpr;
template<typename T, int lvl, typename AT>
struct cast_armv7_gpr<vm::_ptr_base<T, lvl, AT>, false>
{
__forceinline static u32 to_gpr(const vm::_ptr_base<T, lvl, AT>& value)
force_inline static u32 to_gpr(const vm::_ptr_base<T, lvl, AT>& value)
{
return cast_armv7_gpr<AT, std::is_enum<AT>::value>::to_gpr(value.addr());
}
__forceinline static vm::_ptr_base<T, lvl, AT> from_gpr(const u32 reg)
force_inline static vm::_ptr_base<T, lvl, AT> from_gpr(const u32 reg)
{
return vm::_ptr_base<T, lvl, AT>::make(cast_armv7_gpr<AT, std::is_enum<AT>::value>::from_gpr(reg));
}

View File

@ -109,7 +109,7 @@ namespace fmt
{
typedef typename unveil<AT>::result_type result_type;
__forceinline static result_type get_value(const vm::_ref_base<T, AT>& arg)
force_inline static result_type get_value(const vm::_ref_base<T, AT>& arg)
{
return unveil<AT>::get_value(arg.addr());
}
@ -124,12 +124,12 @@ struct cast_ppu_gpr;
template<typename T, typename AT>
struct cast_ppu_gpr<vm::_ref_base<T, AT>, false>
{
__forceinline static u64 to_gpr(const vm::_ref_base<T, AT>& value)
force_inline static u64 to_gpr(const vm::_ref_base<T, AT>& value)
{
return cast_ppu_gpr<AT, std::is_enum<AT>::value>::to_gpr(value.addr());
}
__forceinline static vm::_ref_base<T, AT> from_gpr(const u64 reg)
force_inline static vm::_ref_base<T, AT> from_gpr(const u64 reg)
{
return vm::_ref_base<T, AT>::make(cast_ppu_gpr<AT, std::is_enum<AT>::value>::from_gpr(reg));
}
@ -143,12 +143,12 @@ struct cast_armv7_gpr;
template<typename T, typename AT>
struct cast_armv7_gpr<vm::_ref_base<T, AT>, false>
{
__forceinline static u32 to_gpr(const vm::_ref_base<T, AT>& value)
force_inline static u32 to_gpr(const vm::_ref_base<T, AT>& value)
{
return cast_armv7_gpr<AT, std::is_enum<AT>::value>::to_gpr(value.addr());
}
__forceinline static vm::_ref_base<T, AT> from_gpr(const u32 reg)
force_inline static vm::_ref_base<T, AT> from_gpr(const u32 reg)
{
return vm::_ref_base<T, AT>::make(cast_armv7_gpr<AT, std::is_enum<AT>::value>::from_gpr(reg));
}

View File

@ -425,7 +425,7 @@ namespace vm
return m_addr;
}
__forceinline uint count() const
force_inline uint count() const
{
return _count;
}

View File

@ -24,7 +24,7 @@ namespace cb_detail
{
static_assert(sizeof(T) <= 8, "Invalid callback argument type for ARG_GENERAL");
__forceinline static void set_value(PPUThread& CPU, const T& arg)
force_inline static void set_value(PPUThread& CPU, const T& arg)
{
CPU.GPR[g_count + 2] = cast_to_ppu_gpr<T>(arg);
}
@ -35,7 +35,7 @@ namespace cb_detail
{
static_assert(sizeof(T) <= 8, "Invalid callback argument type for ARG_FLOAT");
__forceinline static void set_value(PPUThread& CPU, const T& arg)
force_inline static void set_value(PPUThread& CPU, const T& arg)
{
CPU.FPR[f_count] = static_cast<T>(arg);
}
@ -46,7 +46,7 @@ namespace cb_detail
{
static_assert(std::is_same<T, u128>::value, "Invalid callback argument type for ARG_VECTOR");
__forceinline static void set_value(PPUThread& CPU, const T& arg)
force_inline static void set_value(PPUThread& CPU, const T& arg)
{
CPU.VPR[v_count + 1] = arg;
}
@ -59,7 +59,7 @@ namespace cb_detail
static_assert(v_count <= 12, "TODO: Unsupported stack argument type (vector)");
static_assert(sizeof(T) <= 8, "Invalid callback argument type for ARG_STACK");
__forceinline static void set_value(PPUThread& CPU, const T& arg)
force_inline static void set_value(PPUThread& CPU, const T& arg)
{
const int stack_pos = (g_count - 9) * 8 - FIXED_STACK_FRAME_SIZE;
static_assert(stack_pos < 0, "TODO: Increase fixed stack frame size (arg count limit broken)");
@ -68,14 +68,14 @@ namespace cb_detail
};
template<int g_count, int f_count, int v_count>
__forceinline static bool _bind_func_args(PPUThread& CPU)
force_inline static bool _bind_func_args(PPUThread& CPU)
{
// terminator
return false;
}
template<int g_count, int f_count, int v_count, typename T1, typename... T>
__forceinline static bool _bind_func_args(PPUThread& CPU, T1 arg1, T... args)
force_inline static bool _bind_func_args(PPUThread& CPU, T1 arg1, T... args)
{
static_assert(!std::is_pointer<T1>::value, "Invalid callback argument type (pointer)");
static_assert(!std::is_reference<T1>::value, "Invalid callback argument type (reference)");
@ -99,7 +99,7 @@ namespace cb_detail
static_assert(type == ARG_GENERAL, "Wrong use of _func_res template");
static_assert(sizeof(T) <= 8, "Invalid callback result type for ARG_GENERAL");
__forceinline static T get_value(const PPUThread& CPU)
force_inline static T get_value(const PPUThread& CPU)
{
return cast_from_ppu_gpr<T>(CPU.GPR[3]);
}
@ -110,7 +110,7 @@ namespace cb_detail
{
static_assert(sizeof(T) <= 8, "Invalid callback result type for ARG_FLOAT");
__forceinline static T get_value(const PPUThread& CPU)
force_inline static T get_value(const PPUThread& CPU)
{
return static_cast<T>(CPU.FPR[1]);
}
@ -121,7 +121,7 @@ namespace cb_detail
{
static_assert(std::is_same<T, u128>::value, "Invalid callback result type for ARG_VECTOR");
__forceinline static T get_value(const PPUThread& CPU)
force_inline static T get_value(const PPUThread& CPU)
{
return CPU.VPR[2];
}
@ -130,7 +130,7 @@ namespace cb_detail
template<typename RT, typename... T>
struct _func_caller
{
__forceinline static RT call(PPUThread& CPU, u32 pc, u32 rtoc, T... args)
force_inline static RT call(PPUThread& CPU, u32 pc, u32 rtoc, T... args)
{
_func_caller<void, T...>::call(CPU, pc, rtoc, args...);
@ -147,7 +147,7 @@ namespace cb_detail
template<typename... T>
struct _func_caller<void, T...>
{
__forceinline static void call(PPUThread& CPU, u32 pc, u32 rtoc, T... args)
force_inline static void call(PPUThread& CPU, u32 pc, u32 rtoc, T... args)
{
const bool stack = _bind_func_args<0, 0, 0, T...>(CPU, args...);
if (stack) CPU.GPR[1] -= FIXED_STACK_FRAME_SIZE;
@ -162,7 +162,7 @@ namespace cb_detail
namespace vm
{
template<typename AT, typename RT, typename... T>
__forceinline RT _ptr_base<RT(T...), 1, AT>::operator()(PPUThread& CPU, T... args) const
force_inline RT _ptr_base<RT(T...), 1, AT>::operator()(PPUThread& CPU, T... args) const
{
const auto data = vm::get_ptr<be_t<u32>>(vm::cast(m_addr));
const u32 pc = data[0];
@ -172,14 +172,14 @@ namespace vm
}
template<typename AT, typename RT, typename... T>
__forceinline RT _ptr_base<RT(T...), 1, AT>::operator()(T... args) const
force_inline RT _ptr_base<RT(T...), 1, AT>::operator()(T... args) const
{
return operator()(GetCurrentPPUThread(), args...);
}
}
template<typename RT, typename... T>
__forceinline RT cb_call(PPUThread& CPU, u32 pc, u32 rtoc, T... args)
force_inline RT cb_call(PPUThread& CPU, u32 pc, u32 rtoc, T... args)
{
return cb_detail::_func_caller<RT, T...>::call(CPU, pc, rtoc, args...);
}

View File

@ -17,8 +17,7 @@ class LogBase
void LogOutput(LogType type, const std::string& text) const;
template<typename... Targs>
__noinline void LogPrepare(LogType type, const char* fmt, Targs... args) const
template<typename... Args> never_inline void LogPrepare(LogType type, const char* fmt, Args... args) const
{
LogOutput(type, fmt::Format(fmt, args...));
}
@ -36,14 +35,12 @@ public:
virtual const std::string& GetName() const = 0;
template<typename... Targs>
__forceinline void Notice(const char* fmt, Targs... args) const
template<typename... Args> force_inline void Notice(const char* fmt, Args... args) printf_alike(2, 3) const
{
LogPrepare(LogNotice, fmt, fmt::do_unveil(args)...);
}
template<typename... Targs>
__forceinline void Log(const char* fmt, Targs... args) const
template<typename... Args> force_inline void Log(const char* fmt, Args... args) printf_alike(2, 3) const
{
if (CheckLogging())
{
@ -51,32 +48,27 @@ public:
}
}
template<typename... Targs>
__forceinline void Success(const char* fmt, Targs... args) const
template<typename... Args> force_inline void Success(const char* fmt, Args... args) printf_alike(2, 3) const
{
LogPrepare(LogSuccess, fmt, fmt::do_unveil(args)...);
}
template<typename... Targs>
__forceinline void Warning(const char* fmt, Targs... args) const
template<typename... Args> force_inline void Warning(const char* fmt, Args... args) printf_alike(2, 3) const
{
LogPrepare(LogWarning, fmt, fmt::do_unveil(args)...);
}
template<typename... Targs>
__forceinline void Error(const char* fmt, Targs... args) const
template<typename... Args> force_inline void Error(const char* fmt, Args... args) printf_alike(2, 3) const
{
LogPrepare(LogError, fmt, fmt::do_unveil(args)...);
}
template<typename... Targs>
__forceinline void Fatal(const char* fmt, Targs... args) const
template<typename... Args> force_inline void Fatal(const char* fmt, Args... args) printf_alike(2, 3) const
{
LogPrepare(LogFatal, fmt, fmt::do_unveil(args)...);
}
template<typename... Targs>
__forceinline void Todo(const char* fmt, Targs... args) const
template<typename... Args> force_inline void Todo(const char* fmt, Args... args) printf_alike(2, 3) const
{
LogPrepare(LogTodo, fmt, fmt::do_unveil(args)...);
}

View File

@ -33,7 +33,7 @@ enum : u32
SAVEDATA_OP_FIXED_DELETE = 14,
};
__noinline s32 savedata_op(
never_inline s32 savedata_op(
PPUThread& CPU,
u32 operation,
u32 version,
@ -61,7 +61,8 @@ __noinline s32 savedata_op(
return CELL_SAVEDATA_ERROR_BUSY;
}
std::string base_dir = "/dev_hdd0/home/00000001/savedata/"; // TODO: Get the path of the current or specified user
// path of the specified user (00000001 by default)
const std::string base_dir = fmt::format("/dev_hdd0/home/%08d/savedata/", userId ? userId : 1u);
vm::stackvar<CellSaveDataCBResult> result(CPU);
@ -498,7 +499,7 @@ __noinline s32 savedata_op(
fileGet->excSize = 0;
memset(fileGet->reserved, 0, sizeof(fileGet->reserved));
while (true)
while (funcFile)
{
funcFile(CPU, result, fileGet, fileSet);
@ -785,10 +786,10 @@ s32 cellSaveDataUserListSave(
u32 container,
vm::ptr<void> userdata)
{
cellSysutil.Todo("cellSaveDataUserListSave(version=%d, userId=%d, setList=*0x%x, setBuf=*0x%x, funcList=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)",
cellSysutil.Error("cellSaveDataUserListSave(version=%d, userId=%d, setList=*0x%x, setBuf=*0x%x, funcList=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)",
version, userId, setList, setBuf, funcList, funcStat, funcFile, container, userdata);
return CELL_OK;
return savedata_op(CPU, SAVEDATA_OP_LIST_SAVE, version, vm::null, 0, setList, setBuf, funcList, vm::null, funcStat, funcFile, container, 6, userdata, userId, vm::null);
}
s32 cellSaveDataUserListLoad(
@ -803,10 +804,10 @@ s32 cellSaveDataUserListLoad(
u32 container,
vm::ptr<void> userdata)
{
cellSysutil.Todo("cellSaveDataUserListLoad(version=%d, userId=%d, setList=*0x%x, setBuf=*0x%x, funcList=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)",
cellSysutil.Error("cellSaveDataUserListLoad(version=%d, userId=%d, setList=*0x%x, setBuf=*0x%x, funcList=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)",
version, userId, setList, setBuf, funcList, funcStat, funcFile, container, userdata);
return CELL_OK;
return savedata_op(CPU, SAVEDATA_OP_LIST_LOAD, version, vm::null, 0, setList, setBuf, funcList, vm::null, funcStat, funcFile, container, 6, userdata, userId, vm::null);
}
s32 cellSaveDataUserFixedSave(
@ -821,10 +822,10 @@ s32 cellSaveDataUserFixedSave(
u32 container,
vm::ptr<void> userdata)
{
cellSysutil.Todo("cellSaveDataUserFixedSave(version=%d, userId=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)",
cellSysutil.Error("cellSaveDataUserFixedSave(version=%d, userId=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)",
version, userId, setList, setBuf, funcFixed, funcStat, funcFile, container, userdata);
return CELL_OK;
return savedata_op(CPU, SAVEDATA_OP_FIXED_SAVE, version, vm::null, 0, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 6, userdata, userId, vm::null);
}
s32 cellSaveDataUserFixedLoad(
@ -839,10 +840,10 @@ s32 cellSaveDataUserFixedLoad(
u32 container,
vm::ptr<void> userdata)
{
cellSysutil.Todo("cellSaveDataUserFixedLoad(version=%d, userId=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)",
cellSysutil.Error("cellSaveDataUserFixedLoad(version=%d, userId=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)",
version, userId, setList, setBuf, funcFixed, funcStat, funcFile, container, userdata);
return CELL_OK;
return savedata_op(CPU, SAVEDATA_OP_FIXED_LOAD, version, vm::null, 0, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 6, userdata, userId, vm::null);
}
s32 cellSaveDataUserAutoSave(
@ -857,10 +858,10 @@ s32 cellSaveDataUserAutoSave(
u32 container,
vm::ptr<void> userdata)
{
cellSysutil.Todo("cellSaveDataUserAutoSave(version=%d, userId=%d, dirName=*0x%x, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)",
cellSysutil.Error("cellSaveDataUserAutoSave(version=%d, userId=%d, dirName=*0x%x, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)",
version, userId, dirName, errDialog, setBuf, funcStat, funcFile, container, userdata);
return CELL_OK;
return savedata_op(CPU, SAVEDATA_OP_AUTO_SAVE, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 6, userdata, userId, vm::null);
}
s32 cellSaveDataUserAutoLoad(
@ -875,10 +876,10 @@ s32 cellSaveDataUserAutoLoad(
u32 container,
vm::ptr<void> userdata)
{
cellSysutil.Todo("cellSaveDataUserAutoLoad(version=%d, userId=%d, dirName=*0x%x, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)",
cellSysutil.Error("cellSaveDataUserAutoLoad(version=%d, userId=%d, dirName=*0x%x, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)",
version, userId, dirName, errDialog, setBuf, funcStat, funcFile, container, userdata);
return CELL_OK;
return savedata_op(CPU, SAVEDATA_OP_AUTO_LOAD, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 6, userdata, userId, vm::null);
}
s32 cellSaveDataUserListAutoSave(
@ -894,10 +895,10 @@ s32 cellSaveDataUserListAutoSave(
u32 container,
vm::ptr<void> userdata)
{
cellSysutil.Todo("cellSaveDataUserListAutoSave(version=%d, userId=%d, errDialog=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)",
cellSysutil.Error("cellSaveDataUserListAutoSave(version=%d, userId=%d, errDialog=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)",
version, userId, errDialog, setList, setBuf, funcFixed, funcStat, funcFile, container, userdata);
return CELL_OK;
return savedata_op(CPU, SAVEDATA_OP_LIST_AUTO_SAVE, version, vm::null, errDialog, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 6, userdata, userId, vm::null);
}
s32 cellSaveDataUserListAutoLoad(
@ -913,10 +914,10 @@ s32 cellSaveDataUserListAutoLoad(
u32 container,
vm::ptr<void> userdata)
{
cellSysutil.Todo("cellSaveDataUserListAutoLoad(version=%d, userId=%d, errDialog=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)",
cellSysutil.Error("cellSaveDataUserListAutoLoad(version=%d, userId=%d, errDialog=%d, setList=*0x%x, setBuf=*0x%x, funcFixed=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)",
version, userId, errDialog, setList, setBuf, funcFixed, funcStat, funcFile, container, userdata);
return CELL_OK;
return savedata_op(CPU, SAVEDATA_OP_LIST_AUTO_LOAD, version, vm::null, errDialog, setList, setBuf, vm::null, funcFixed, funcStat, funcFile, container, 6, userdata, userId, vm::null);
}
s32 cellSaveDataUserFixedDelete(
@ -937,7 +938,7 @@ s32 cellSaveDataUserFixedDelete(
void cellSaveDataEnableOverlay(s32 enable)
{
cellSysutil.Todo("cellSaveDataEnableOverlay(enable=%d)", enable);
cellSysutil.Error("cellSaveDataEnableOverlay(enable=%d)", enable);
return;
}

View File

@ -528,7 +528,7 @@ struct CellSpurs
} c;
};
__forceinline atomic_be_t<u8>& wklState(const u32 wid)
force_inline atomic_be_t<u8>& wklState(const u32 wid)
{
if (wid & 0x10)
{
@ -540,12 +540,12 @@ struct CellSpurs
}
}
__forceinline vm::ptr<sys_lwmutex_t> get_lwmutex()
force_inline vm::ptr<sys_lwmutex_t> get_lwmutex()
{
return vm::ptr<sys_lwmutex_t>::make(vm::get_addr(&m.mutex));
}
__forceinline vm::ptr<sys_lwcond_t> get_lwcond()
force_inline vm::ptr<sys_lwcond_t> get_lwcond()
{
return vm::ptr<sys_lwcond_t>::make(vm::get_addr(&m.cond));
}

View File

@ -21,7 +21,7 @@ namespace ppu_func_detail
{
static_assert(sizeof(T) <= 8, "Invalid function argument type for ARG_GENERAL");
static __forceinline T get_arg(PPUThread& CPU)
static force_inline T get_arg(PPUThread& CPU)
{
return cast_from_ppu_gpr<T>(CPU.GPR[g_count + 2]);
}
@ -32,7 +32,7 @@ namespace ppu_func_detail
{
static_assert(sizeof(T) <= 8, "Invalid function argument type for ARG_FLOAT");
static __forceinline T get_arg(PPUThread& CPU)
static force_inline T get_arg(PPUThread& CPU)
{
return static_cast<T>(CPU.FPR[f_count]);
}
@ -43,7 +43,7 @@ namespace ppu_func_detail
{
static_assert(std::is_same<T, u128>::value, "Invalid function argument type for ARG_VECTOR");
static __forceinline T get_arg(PPUThread& CPU)
static force_inline T get_arg(PPUThread& CPU)
{
return CPU.VPR[v_count + 1];
}
@ -56,7 +56,7 @@ namespace ppu_func_detail
static_assert(v_count <= 12, "TODO: Unsupported stack argument type (vector)");
static_assert(sizeof(T) <= 8, "Invalid function argument type for ARG_STACK");
static __forceinline T get_arg(PPUThread& CPU)
static force_inline T get_arg(PPUThread& CPU)
{
// TODO: check stack argument displacement
const u64 res = CPU.GetStackArg(8 + std::max(g_count - 8, 0) + std::max(f_count - 13, 0) + std::max(v_count - 12, 0));
@ -70,7 +70,7 @@ namespace ppu_func_detail
static_assert(type == ARG_GENERAL, "Wrong use of bind_result template");
static_assert(sizeof(T) <= 8, "Invalid function result type for ARG_GENERAL");
static __forceinline void put_result(PPUThread& CPU, const T& result)
static force_inline void put_result(PPUThread& CPU, const T& result)
{
CPU.GPR[3] = cast_to_ppu_gpr<T>(result);
}
@ -81,7 +81,7 @@ namespace ppu_func_detail
{
static_assert(sizeof(T) <= 8, "Invalid function result type for ARG_FLOAT");
static __forceinline void put_result(PPUThread& CPU, const T& result)
static force_inline void put_result(PPUThread& CPU, const T& result)
{
CPU.FPR[1] = static_cast<T>(result);
}
@ -92,7 +92,7 @@ namespace ppu_func_detail
{
static_assert(std::is_same<T, u128>::value, "Invalid function result type for ARG_VECTOR");
static __forceinline void put_result(PPUThread& CPU, const T& result)
static force_inline void put_result(PPUThread& CPU, const T& result)
{
CPU.VPR[2] = result;
}
@ -109,7 +109,7 @@ namespace ppu_func_detail
template<typename T, u32 type_pack>
struct bind_arg_packed
{
static __forceinline T get_arg(PPUThread& CPU)
static force_inline T get_arg(PPUThread& CPU)
{
return bind_arg<T, type_pack, (type_pack >> 8), (type_pack >> 16), (type_pack >> 24)>::get_arg(CPU);
}
@ -118,7 +118,7 @@ namespace ppu_func_detail
template <typename RT, typename F, typename Tuple, bool Done, int Total, int... N>
struct call_impl
{
static __forceinline RT call(F f, Tuple && t)
static force_inline RT call(F f, Tuple && t)
{
return call_impl<RT, F, Tuple, Total == 1 + sizeof...(N), Total, N..., sizeof...(N)>::call(f, std::forward<Tuple>(t));
}
@ -127,28 +127,28 @@ namespace ppu_func_detail
template <typename RT, typename F, typename Tuple, int Total, int... N>
struct call_impl<RT, F, Tuple, true, Total, N...>
{
static __forceinline RT call(F f, Tuple && t)
static force_inline RT call(F f, Tuple && t)
{
return f(std::get<N>(std::forward<Tuple>(t))...);
}
};
template <typename RT, typename F, typename Tuple>
__forceinline RT call(F f, Tuple && t)
force_inline RT call(F f, Tuple && t)
{
typedef typename std::decay<Tuple>::type ttype;
return ppu_func_detail::call_impl<RT, F, Tuple, 0 == std::tuple_size<ttype>::value, std::tuple_size<ttype>::value>::call(f, std::forward<Tuple>(t));
}
template<u32 g_count, u32 f_count, u32 v_count>
__forceinline std::tuple<> iterate(PPUThread& CPU)
force_inline std::tuple<> iterate(PPUThread& CPU)
{
// terminator
return std::tuple<>();
}
template<u32 g_count, u32 f_count, u32 v_count, typename T, typename... A>
__forceinline std::tuple<T, A...> iterate(PPUThread& CPU)
force_inline std::tuple<T, A...> iterate(PPUThread& CPU)
{
static_assert(!std::is_pointer<T>::value, "Invalid function argument type (pointer)");
static_assert(!std::is_reference<T>::value, "Invalid function argument type (reference)");
@ -223,7 +223,7 @@ namespace ppu_func_detail
};
}
template<typename RT, typename... T> __forceinline void call_ppu_func(PPUThread& CPU, RT(*func)(T...))
template<typename RT, typename... T> force_inline void call_ppu_func(PPUThread& CPU, RT(*func)(T...))
{
ppu_func_detail::func_binder<RT, T...>::do_call(CPU, func);
}

View File

@ -190,10 +190,10 @@ public:
void SavePoints(const std::string& path);
void LoadPoints(const std::string& path);
__forceinline bool IsRunning() const { return m_status == Running; }
__forceinline bool IsPaused() const { return m_status == Paused; }
__forceinline bool IsStopped() const { return m_status == Stopped; }
__forceinline bool IsReady() const { return m_status == Ready; }
force_inline bool IsRunning() const { return m_status == Running; }
force_inline bool IsPaused() const { return m_status == Paused; }
force_inline bool IsStopped() const { return m_status == Stopped; }
force_inline bool IsReady() const { return m_status == Ready; }
};
using lv2_lock_type = std::unique_lock<std::mutex>;

View File

@ -52,7 +52,7 @@ typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;
template<typename T> __forceinline T align(const T addr, int align)
template<typename T> force_inline T align(const T addr, int align)
{
return (addr + (align - 1)) & ~(align - 1);
}