From 73555c1df178e2d4ec1e49e46e712e4528efd5ac Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Tue, 2 Sep 2014 01:22:07 +0400 Subject: [PATCH] Compilation fix 4 --- Utilities/BEType.h | 6 ++--- rpcs3/Emu/Memory/vm_ref.h | 47 +++++++++++++++++++++++++++------------ 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/Utilities/BEType.h b/Utilities/BEType.h index d2dc61b663..e8a072851d 100644 --- a/Utilities/BEType.h +++ b/Utilities/BEType.h @@ -175,11 +175,9 @@ template struct is_be_t : public std::integral_constant {}; template -struct is_be_t, T2> : public std::integral_constant -{ -}; +struct is_be_t, T2> : public std::integral_constant {}; -template +template struct remove_be_t { typedef T type; diff --git a/rpcs3/Emu/Memory/vm_ref.h b/rpcs3/Emu/Memory/vm_ref.h index 539c7c0115..ad238223e7 100644 --- a/rpcs3/Emu/Memory/vm_ref.h +++ b/rpcs3/Emu/Memory/vm_ref.h @@ -10,6 +10,8 @@ namespace vm public: typedef T type; + typedef typename remove_be_t::type le_type; + typedef typename to_be_t::type be_type; operator T&() { @@ -30,34 +32,54 @@ namespace vm { return (_ref_base&)addr; } + + _ref_base& operator = (le_type right) + { + get_ref(m_addr) = right; + return *this; + } + + const _ref_base& operator = (le_type right) const + { + get_ref(m_addr) = right; + return *this; + } + + _ref_base& operator = (be_type right) + { + get_ref(m_addr) = right; + return *this; + } + + const _ref_base& operator = (be_type right) const + { + get_ref(m_addr) = right; + return *this; + } }; //BE reference to LE data template struct brefl : public _ref_base::type> { - brefl& operator = (T right) { get_ref(m_addr) = right; return *this; } - const brefl& operator = (T right) const { get_ref(m_addr) = right; return *this; } + using _ref_base::operator=; }; //BE reference to BE data template struct brefb : public _ref_base::type, typename to_be_t::type> { - brefb& operator = (T right) { get_ref(m_addr) = right; return *this; } - const brefb& operator = (T right) const { get_ref(m_addr) = right; return *this; } + using _ref_base::operator=; }; //LE reference to BE data template struct lrefb : public _ref_base::type, AT> { - lrefb& operator = (T right) { get_ref(m_addr) = right; return *this; } - const lrefb& operator = (T right) const { get_ref(m_addr) = right; return *this; } + using _ref_base::operator=; }; //LE reference to LE data template struct lrefl : public _ref_base { - lrefl& operator = (T right) { get_ref(m_addr) = right; return *this; } - const lrefl& operator = (T right) const { get_ref(m_addr) = right; return *this; } + using _ref_base::operator=; }; namespace ps3 @@ -65,15 +87,13 @@ namespace vm //default reference for HLE functions (LE reference to BE data) template struct ref : public lrefb { - ref& operator = (T right) { get_ref(m_addr) = right; return *this; } - const ref& operator = (T right) const { get_ref(m_addr) = right; return *this; } + using _ref_base::operator=; }; //default reference for HLE structures (BE reference to BE data) template struct bref : public brefb { - bref& operator = (T right) { get_ref(m_addr) = right; return *this; } - const bref& operator = (T right) const { get_ref(m_addr) = right; return *this; } + using _ref_base::operator=; }; } @@ -82,8 +102,7 @@ namespace vm //default reference for HLE functions & structures (LE reference to LE data) template struct ref : public lrefl { - ref& operator = (T right) { get_ref(m_addr) = right; return *this; } - const ref& operator = (T right) const { get_ref(m_addr) = right; return *this; } + using _ref_base::operator=; }; }