diff --git a/Utilities/BEType.h b/Utilities/BEType.h index 750aef064e..a3be82af61 100644 --- a/Utilities/BEType.h +++ b/Utilities/BEType.h @@ -45,18 +45,18 @@ template struct se_t //template T re(const T val) { T res; se_t::func(res, val); return res; } //template void re(T1& dst, const T2 val) { se_t::func(dst, val); } -template struct const_se_t; -template struct const_se_t +template struct const_se_t; +template struct const_se_t { static const T value = (T)_value; }; -template struct const_se_t +template struct const_se_t { static const T value = ((_value >> 8) & 0xff) | ((_value << 8) & 0xff00); }; -template struct const_se_t +template struct const_se_t { static const T value = ((_value >> 24) & 0x000000ff) | @@ -65,7 +65,7 @@ template struct const_se_t ((_value << 24) & 0xff000000); }; -template struct const_se_t +template struct const_se_t { static const T value = ((_value >> 56) & 0x00000000000000ff) | @@ -334,10 +334,22 @@ public: typedef const void type; }; +template +struct invert_be_t +{ + typedef typename to_be_t::type type; +}; + +template +struct invert_be_t> +{ + typedef T type; +}; + template struct _se : public const_se_t {}; template struct _se, T1, value> : public const_se_t {}; -#define se(t, x) _se::value +//#define se(t, x) _se::value #define se16(x) _se::value #define se32(x) _se::value #define se64(x) _se::value diff --git a/rpcs3/Emu/Cell/SPUThread.cpp b/rpcs3/Emu/Cell/SPUThread.cpp index 4017366e98..7b5ace6a67 100644 --- a/rpcs3/Emu/Cell/SPUThread.cpp +++ b/rpcs3/Emu/Cell/SPUThread.cpp @@ -301,7 +301,7 @@ void SPUThread::ListCmd(u32 lsa, u64 ea, u16 tag, u16 size, u32 cmd, MFCReg& MFC lsa += std::max(size, (u32)16); - if (rec->s & se16(0x8000)) + if (rec->s.ToBE() & se16(0x8000)) { StallStat.PushUncond_OR(1 << tag); diff --git a/rpcs3/Emu/SysCalls/lv2/sys_rwlock.cpp b/rpcs3/Emu/SysCalls/lv2/sys_rwlock.cpp index 8e4d323d18..aec4007308 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_rwlock.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_rwlock.cpp @@ -18,10 +18,10 @@ s32 sys_rwlock_create(vm::ptr> rw_lock_id, vm::ptrattr_protocol.ToBE()) { - case se(attr->attr_protocol, SYS_SYNC_PRIORITY): sys_rwlock.Todo("SYS_SYNC_PRIORITY"); break; - case se(attr->attr_protocol, SYS_SYNC_RETRY): sys_rwlock.Error("SYS_SYNC_RETRY"); return CELL_EINVAL; - case se(attr->attr_protocol, SYS_SYNC_PRIORITY_INHERIT): sys_rwlock.Todo("SYS_SYNC_PRIORITY_INHERIT"); break; - case se(attr->attr_protocol, SYS_SYNC_FIFO): break; + case se32(SYS_SYNC_PRIORITY): sys_rwlock.Todo("SYS_SYNC_PRIORITY"); break; + case se32(SYS_SYNC_RETRY): sys_rwlock.Error("SYS_SYNC_RETRY"); return CELL_EINVAL; + case se32(SYS_SYNC_PRIORITY_INHERIT): sys_rwlock.Todo("SYS_SYNC_PRIORITY_INHERIT"); break; + case se32(SYS_SYNC_FIFO): break; default: return CELL_EINVAL; }