citra-emu
/
citra-canary
Archived
1
0
Fork 0

emitter: templatize ImmPtr

This commit is contained in:
Lioncash 2016-03-09 02:41:07 -05:00
parent 1351c0ce9f
commit e3f9d09b28
1 changed files with 6 additions and 2 deletions

View File

@ -274,11 +274,15 @@ constexpr OpArg SImmAuto(s32 imm) {
return OpArg(imm, (imm >= 128 || imm < -128) ? SCALE_IMM32 : SCALE_IMM8); return OpArg(imm, (imm >= 128 || imm < -128) ? SCALE_IMM32 : SCALE_IMM8);
} }
template <typename T>
OpArg ImmPtr(const T* imm)
{
#ifdef _ARCH_64 #ifdef _ARCH_64
inline OpArg ImmPtr(const void* imm) {return Imm64((u64)imm);} return Imm64(reinterpret_cast<u64>(imm));
#else #else
inline OpArg ImmPtr(const void* imm) {return Imm32((u32)imm);} return Imm32(reinterpret_cast<u32>(imm));
#endif #endif
}
inline u32 PtrOffset(const void* ptr, const void* base) inline u32 PtrOffset(const void* ptr, const void* base)
{ {