Compilation fix 4

This commit is contained in:
Nekotekina 2014-09-02 01:22:07 +04:00
parent 4f6a407393
commit 73555c1df1
2 changed files with 35 additions and 18 deletions

View File

@ -175,11 +175,9 @@ template<typename T, typename T2 = T>
struct is_be_t : public std::integral_constant<bool, false> {};
template<typename T, typename T2>
struct is_be_t<be_t<T, T2>, T2> : public std::integral_constant<bool, true>
{
};
struct is_be_t<be_t<T, T2>, T2> : public std::integral_constant<bool, true> {};
template<typename T>
template<typename T, typename T2 = T>
struct remove_be_t
{
typedef T type;

View File

@ -10,6 +10,8 @@ namespace vm
public:
typedef T type;
typedef typename remove_be_t<T>::type le_type;
typedef typename to_be_t<T>::type be_type;
operator T&()
{
@ -30,34 +32,54 @@ namespace vm
{
return (_ref_base&)addr;
}
_ref_base& operator = (le_type right)
{
get_ref<T>(m_addr) = right;
return *this;
}
const _ref_base& operator = (le_type right) const
{
get_ref<T>(m_addr) = right;
return *this;
}
_ref_base& operator = (be_type right)
{
get_ref<T>(m_addr) = right;
return *this;
}
const _ref_base& operator = (be_type right) const
{
get_ref<T>(m_addr) = right;
return *this;
}
};
//BE reference to LE data
template<typename T, typename AT = u32> struct brefl : public _ref_base<T, typename to_be_t<AT>::type>
{
brefl& operator = (T right) { get_ref<T>(m_addr) = right; return *this; }
const brefl& operator = (T right) const { get_ref<T>(m_addr) = right; return *this; }
using _ref_base::operator=;
};
//BE reference to BE data
template<typename T, typename AT = u32> struct brefb : public _ref_base<typename to_be_t<T>::type, typename to_be_t<AT>::type>
{
brefb& operator = (T right) { get_ref<T>(m_addr) = right; return *this; }
const brefb& operator = (T right) const { get_ref<T>(m_addr) = right; return *this; }
using _ref_base::operator=;
};
//LE reference to BE data
template<typename T, typename AT = u32> struct lrefb : public _ref_base<typename to_be_t<T>::type, AT>
{
lrefb& operator = (T right) { get_ref<T>(m_addr) = right; return *this; }
const lrefb& operator = (T right) const { get_ref<T>(m_addr) = right; return *this; }
using _ref_base::operator=;
};
//LE reference to LE data
template<typename T, typename AT = u32> struct lrefl : public _ref_base<T, AT>
{
lrefl& operator = (T right) { get_ref<T>(m_addr) = right; return *this; }
const lrefl& operator = (T right) const { get_ref<T>(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<typename T, typename AT = u32> struct ref : public lrefb<T, AT>
{
ref& operator = (T right) { get_ref<T>(m_addr) = right; return *this; }
const ref& operator = (T right) const { get_ref<T>(m_addr) = right; return *this; }
using _ref_base::operator=;
};
//default reference for HLE structures (BE reference to BE data)
template<typename T, typename AT = u32> struct bref : public brefb<T, AT>
{
bref& operator = (T right) { get_ref<T>(m_addr) = right; return *this; }
const bref& operator = (T right) const { get_ref<T>(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<typename T, typename AT = u32> struct ref : public lrefl<T, AT>
{
ref& operator = (T right) { get_ref<T>(m_addr) = right; return *this; }
const ref& operator = (T right) const { get_ref<T>(m_addr) = right; return *this; }
using _ref_base::operator=;
};
}