cast_to_ppu_gpr(), cast_from_ppu_gpr() updated

This commit is contained in:
Nekotekina 2015-01-19 17:16:31 +03:00
parent 3428499492
commit f3c9143a81
5 changed files with 153 additions and 50 deletions

View file

@ -535,3 +535,22 @@ namespace fmt
}
};
}
// external specializations for PPU GPR (SC_FUNC.h, CB_FUNC.h)
template<typename T, bool is_enum>
struct cast_ppu_gpr;
template<typename T, int lvl, typename AT>
struct cast_ppu_gpr<vm::ps3::ptr<T, lvl, AT>, false>
{
__forceinline static u64 to_gpr(const vm::ps3::ptr<T, lvl, AT>& value)
{
return value.addr();
}
__forceinline static vm::ps3::ptr<T, lvl, AT> from_gpr(const u64 reg)
{
return vm::ps3::ptr<T, lvl, AT>::make(cast_ppu_gpr<AT>::from_gpr(reg));
}
};

View file

@ -147,3 +147,22 @@ namespace fmt
}
};
}
// external specializations for PPU GPR (SC_FUNC.h, CB_FUNC.h)
template<typename T, bool is_enum>
struct cast_ppu_gpr;
template<typename T, typename AT>
struct cast_ppu_gpr<vm::ps3::ref<T, AT>, false>
{
__forceinline static u64 to_gpr(const vm::ps3::ref<T, AT>& value)
{
return value.addr();
}
__forceinline static vm::ps3::ref<T, AT> from_gpr(const u64 reg)
{
return vm::ps3::ref<T, AT>::make(cast_ppu_gpr<AT>::from_gpr(reg));
}
};