mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-20 22:05:12 +00:00
split rpcs3 and hle libraries
merge rpcs3 utilities
This commit is contained in:
parent
b33e2662b6
commit
62ad27d1e2
1233 changed files with 7004 additions and 3819 deletions
21
rpcs3/util/bless.hpp
Normal file
21
rpcs3/util/bless.hpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#pragma once
|
||||
|
||||
namespace utils
|
||||
{
|
||||
// Hack. Pointer cast util to workaround UB. Use with extreme care.
|
||||
template <typename T, typename U>
|
||||
[[nodiscard]] T* bless(U* ptr)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
return (T*)ptr;
|
||||
#elif defined(ARCH_X64)
|
||||
T* result;
|
||||
__asm__("movq %1, %0;" : "=r"(result) : "r"(ptr) : "memory");
|
||||
return result;
|
||||
#elif defined(ARCH_ARM64)
|
||||
T* result;
|
||||
__asm__("mov %0, %1" : "=r"(result) : "r"(ptr) : "memory");
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
} // namespace utils
|
||||
Loading…
Add table
Add a link
Reference in a new issue