mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-04 22:11:26 +12:00
Implement ::as_rvalue
This commit is contained in:
parent
e407018bb5
commit
141d62fbf9
4 changed files with 23 additions and 5 deletions
|
@ -167,6 +167,24 @@ using get_uint_t = typename get_int_impl<N>::utype;
|
||||||
template <std::size_t N>
|
template <std::size_t N>
|
||||||
using get_sint_t = typename get_int_impl<N>::stype;
|
using get_sint_t = typename get_int_impl<N>::stype;
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
T as_rvalue(T&& obj)
|
||||||
|
{
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
T as_rvalue(const T& obj)
|
||||||
|
{
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
T as_rvalue(const volatile T& obj)
|
||||||
|
{
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
// Formatting helper, type-specific preprocessing for improving safety and functionality
|
// Formatting helper, type-specific preprocessing for improving safety and functionality
|
||||||
template <typename T, typename = void>
|
template <typename T, typename = void>
|
||||||
struct fmt_unveil;
|
struct fmt_unveil;
|
||||||
|
|
|
@ -846,7 +846,7 @@ spu_function_t spu_recompiler::compile(spu_program&& _func)
|
||||||
c->jmp(imm_ptr(spu_runtime::tr_dispatch));
|
c->jmp(imm_ptr(spu_runtime::tr_dispatch));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto&& work : decltype(after)(std::move(after)))
|
for (auto&& work : ::as_rvalue(std::move(after)))
|
||||||
{
|
{
|
||||||
work();
|
work();
|
||||||
}
|
}
|
||||||
|
|
|
@ -476,7 +476,7 @@ error_code sys_usbd_finalize(ppu_thread& ppu, u32 handle)
|
||||||
usbh->is_init = false;
|
usbh->is_init = false;
|
||||||
|
|
||||||
// Forcefully awake all waiters
|
// Forcefully awake all waiters
|
||||||
for (auto& cpu : decltype(usbh->sq)(std::move(usbh->sq)))
|
for (auto& cpu : ::as_rvalue(std::move(usbh->sq)))
|
||||||
{
|
{
|
||||||
// Special ternimation signal value
|
// Special ternimation signal value
|
||||||
cpu->gpr[4] = 4;
|
cpu->gpr[4] = 4;
|
||||||
|
|
|
@ -574,7 +574,7 @@ public:
|
||||||
|
|
||||||
if (const auto found = find_id<T, Get>(id))
|
if (const auto found = find_id<T, Get>(id))
|
||||||
{
|
{
|
||||||
ptr = std::static_pointer_cast<Get>(std::move(found->second));
|
ptr = std::static_pointer_cast<Get>(::as_rvalue(std::move(found->second)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,7 +594,7 @@ public:
|
||||||
if constexpr (std::is_void_v<FRT>)
|
if constexpr (std::is_void_v<FRT>)
|
||||||
{
|
{
|
||||||
func(*_ptr);
|
func(*_ptr);
|
||||||
return std::static_pointer_cast<Get>(std::move(found->second));
|
return std::static_pointer_cast<Get>(::as_rvalue(std::move(found->second)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -606,7 +606,7 @@ public:
|
||||||
return {{found->second, _ptr}, std::move(ret)};
|
return {{found->second, _ptr}, std::move(ret)};
|
||||||
}
|
}
|
||||||
|
|
||||||
return {std::static_pointer_cast<Get>(std::move(found->second)), std::move(ret)};
|
return {std::static_pointer_cast<Get>(::as_rvalue(std::move(found->second))), std::move(ret)};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue