fix small merge mistake

This commit is contained in:
Bigpet 2014-02-23 18:13:08 +01:00
commit 1be8563fdb
47 changed files with 3065 additions and 785 deletions

View file

@ -2,17 +2,14 @@
#include "Utilities/GNU.h"
#define se16(x) const_se_t<u16, x>::value
#define se32(x) const_se_t<u32, x>::value
#define se64(x) const_se_t<u64, x>::value
template<typename T, int size = sizeof(T)> struct se_t;
template<typename T> struct se_t<T, 1> { static __forceinline void func(T& dst, const T src) { (u8&)dst = (u8&)src; } };
template<typename T> struct se_t<T, 2> { static __forceinline void func(T& dst, const T src) { (u16&)dst = _byteswap_ushort((u16&)src); } };
template<typename T> struct se_t<T, 4> { static __forceinline void func(T& dst, const T src) { (u32&)dst = _byteswap_ulong((u32&)src); } };
template<typename T> struct se_t<T, 8> { static __forceinline void func(T& dst, const T src) { (u64&)dst = _byteswap_uint64((u64&)src); } };
template<typename T, s64 _value, int size = sizeof(T)> struct const_se_t;;
template<typename T, s64 _value, int size = sizeof(T)> struct const_se_t;
template<typename T, s64 _value> struct const_se_t<T, _value, 1>
{
static const T value = (T)_value;
@ -52,6 +49,7 @@ class be_t
T m_data;
public:
typedef T type;
be_t() noexcept = default;
be_t(const T& value)
@ -89,6 +87,20 @@ public:
se_t<T>::func(m_data, value);
}
static be_t MakeFromLE(const T value)
{
be_t res;
res.FromLE(value);
return res;
}
static be_t MakeFromBE(const T value)
{
be_t res;
res.FromBE(value);
return res;
}
//template<typename T1>
operator const T() const
{
@ -152,4 +164,17 @@ public:
template<typename T1> bool operator < (const be_t<T1>& right) const { return (T1)ToLE() < right.ToLE(); }
template<typename T1> bool operator >= (const be_t<T1>& right) const { return (T1)ToLE() >= right.ToLE(); }
template<typename T1> bool operator <= (const be_t<T1>& right) const { return (T1)ToLE() <= right.ToLE(); }
be_t operator++ (int) { be_t res = *this; *this += 1; return res; }
be_t operator-- (int) { be_t res = *this; *this -= 1; return res; }
be_t& operator++ () { *this += 1; return *this; }
be_t& operator-- () { *this -= 1; return *this; }
};
template<typename T, typename T1, T1 value> struct _se : public const_se_t<T, value> {};
template<typename T, typename T1, T1 value> struct _se<be_t<T>, T1, value> : public const_se_t<T, value> {};
#define se(t, x) _se<decltype(t), decltype(x), x>::value
#define se16(x) _se<u16, decltype(x), x>::value
#define se32(x) _se<u32, decltype(x), x>::value
#define se64(x) _se<u64, decltype(x), x>::value