mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 23:02:47 +01:00
emitter: templatize ImmPtr
This commit is contained in:
parent
1351c0ce9f
commit
e3f9d09b28
1 changed files with 6 additions and 2 deletions
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue