2013-10-06 14:07:42 +02:00
|
|
|
#pragma once
|
|
|
|
|
2014-08-22 23:15:02 +02:00
|
|
|
#define re16(val) _byteswap_ushort(val)
|
|
|
|
#define re32(val) _byteswap_ulong(val)
|
|
|
|
#define re64(val) _byteswap_uint64(val)
|
|
|
|
#define re128(val) u128::byteswap(val)
|
2014-05-02 08:30:32 +02:00
|
|
|
|
2013-11-19 22:10:23 +01:00
|
|
|
template<typename T, int size = sizeof(T)> struct se_t;
|
|
|
|
|
2014-09-04 11:21:23 +02:00
|
|
|
template<typename T> struct se_t<T, 1>
|
|
|
|
{
|
|
|
|
static __forceinline T func(const T src)
|
|
|
|
{
|
|
|
|
return src;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T> struct se_t<T, 2>
|
|
|
|
{
|
|
|
|
static __forceinline T func(const T src)
|
|
|
|
{
|
|
|
|
const u16 res = _byteswap_ushort((u16&)src);
|
|
|
|
return (T&)res;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T> struct se_t<T, 4>
|
|
|
|
{
|
|
|
|
static __forceinline T func(const T src)
|
|
|
|
{
|
|
|
|
const u32 res = _byteswap_ulong((u32&)src);
|
|
|
|
return (T&)res;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T> struct se_t<T, 8>
|
|
|
|
{
|
|
|
|
static __forceinline T func(const T src)
|
|
|
|
{
|
|
|
|
const u64 res = _byteswap_uint64((u64&)src);
|
|
|
|
return (T&)res;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//template<typename T> T re(const T val) { T res; se_t<T>::func(res, val); return res; }
|
|
|
|
//template<typename T1, typename T2> void re(T1& dst, const T2 val) { se_t<T1>::func(dst, val); }
|
2014-02-22 03:53:06 +01:00
|
|
|
|
|
|
|
template<typename T, s64 _value, int size = sizeof(T)> struct const_se_t;
|
2013-11-19 11:30:58 +01:00
|
|
|
template<typename T, s64 _value> struct const_se_t<T, _value, 1>
|
2013-11-19 22:10:23 +01:00
|
|
|
{
|
|
|
|
static const T value = (T)_value;
|
|
|
|
};
|
|
|
|
|
2013-11-19 11:30:58 +01:00
|
|
|
template<typename T, s64 _value> struct const_se_t<T, _value, 2>
|
2013-11-19 22:10:23 +01:00
|
|
|
{
|
|
|
|
static const T value = ((_value >> 8) & 0xff) | ((_value << 8) & 0xff00);
|
|
|
|
};
|
|
|
|
|
2013-11-19 11:30:58 +01:00
|
|
|
template<typename T, s64 _value> struct const_se_t<T, _value, 4>
|
2013-11-19 22:10:23 +01:00
|
|
|
{
|
|
|
|
static const T value =
|
|
|
|
((_value >> 24) & 0x000000ff) |
|
|
|
|
((_value >> 8) & 0x0000ff00) |
|
|
|
|
((_value << 8) & 0x00ff0000) |
|
|
|
|
((_value << 24) & 0xff000000);
|
|
|
|
};
|
|
|
|
|
2013-11-19 11:30:58 +01:00
|
|
|
template<typename T, s64 _value> struct const_se_t<T, _value, 8>
|
2013-11-19 22:10:23 +01:00
|
|
|
{
|
|
|
|
static const T value =
|
|
|
|
((_value >> 56) & 0x00000000000000ff) |
|
|
|
|
((_value >> 40) & 0x000000000000ff00) |
|
|
|
|
((_value >> 24) & 0x0000000000ff0000) |
|
|
|
|
((_value >> 8) & 0x00000000ff000000) |
|
|
|
|
((_value << 8) & 0x000000ff00000000) |
|
|
|
|
((_value << 24) & 0x0000ff0000000000) |
|
|
|
|
((_value << 40) & 0x00ff000000000000) |
|
|
|
|
((_value << 56) & 0xff00000000000000);
|
|
|
|
};
|
|
|
|
|
2014-09-01 18:16:44 +02:00
|
|
|
template<typename T, typename T2 = T>
|
2013-10-06 14:07:42 +02:00
|
|
|
class be_t
|
|
|
|
{
|
2014-09-01 18:16:44 +02:00
|
|
|
static_assert(sizeof(T2) == 1 || sizeof(T2) == 2 || sizeof(T2) == 4 || sizeof(T2) == 8, "Bad be_t type");
|
2013-10-06 14:07:42 +02:00
|
|
|
T m_data;
|
|
|
|
|
|
|
|
public:
|
2014-02-22 03:53:06 +01:00
|
|
|
typedef T type;
|
2014-04-10 00:54:32 +02:00
|
|
|
|
2014-01-19 17:05:27 +01:00
|
|
|
const T& ToBE() const
|
2013-10-06 14:07:42 +02:00
|
|
|
{
|
|
|
|
return m_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
T ToLE() const
|
|
|
|
{
|
2014-09-04 11:21:23 +02:00
|
|
|
return se_t<T, sizeof(T2)>::func(m_data);
|
2013-10-06 14:07:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void FromBE(const T& value)
|
|
|
|
{
|
|
|
|
m_data = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void FromLE(const T& value)
|
|
|
|
{
|
2014-09-04 11:21:23 +02:00
|
|
|
m_data = se_t<T, sizeof(T2)>::func(value);
|
2013-10-06 14:07:42 +02:00
|
|
|
}
|
|
|
|
|
2014-02-22 03:53:06 +01:00
|
|
|
static be_t MakeFromLE(const T value)
|
|
|
|
{
|
2014-09-04 11:21:23 +02:00
|
|
|
T data = se_t<T, sizeof(T2)>::func(value);
|
|
|
|
return (be_t&)data;
|
2014-02-22 03:53:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static be_t MakeFromBE(const T value)
|
|
|
|
{
|
2014-09-04 11:21:23 +02:00
|
|
|
return (be_t&)value;
|
2014-02-22 03:53:06 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 14:07:42 +02:00
|
|
|
//template<typename T1>
|
|
|
|
operator const T() const
|
|
|
|
{
|
|
|
|
return ToLE();
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T1>
|
|
|
|
operator const be_t<T1>() const
|
|
|
|
{
|
2014-09-04 11:21:23 +02:00
|
|
|
if (sizeof(T1) > sizeof(T) || std::is_floating_point<T>::value || std::is_floating_point<T1>::value)
|
2014-07-18 18:55:26 +02:00
|
|
|
{
|
2014-09-04 11:21:23 +02:00
|
|
|
T1 res = se_t<T1, sizeof(T1)>::func(ToLE());
|
|
|
|
return (be_t<T1>&)res;
|
2014-07-18 18:55:26 +02:00
|
|
|
}
|
2014-09-04 11:21:23 +02:00
|
|
|
else if (sizeof(T1) < sizeof(T))
|
2014-07-18 18:55:26 +02:00
|
|
|
{
|
2014-09-04 11:21:23 +02:00
|
|
|
T1 res = ToBE() >> ((sizeof(T) - sizeof(T1)) * 8);
|
|
|
|
return (be_t<T1>&)res;
|
2014-07-18 18:55:26 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-04 11:21:23 +02:00
|
|
|
T1 res = ToBE();
|
|
|
|
return (be_t<T1>&)res;
|
2014-07-18 18:55:26 +02:00
|
|
|
}
|
2013-10-06 14:07:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
be_t& operator = (const T& right)
|
|
|
|
{
|
2014-09-04 11:21:23 +02:00
|
|
|
m_data = se_t<T, sizeof(T2)>::func(right);
|
2013-10-06 14:07:42 +02:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2014-09-01 18:16:44 +02:00
|
|
|
be_t& operator = (const be_t& right) = default;
|
2013-10-06 14:07:42 +02:00
|
|
|
|
|
|
|
template<typename T1> be_t& operator += (T1 right) { return *this = T(*this) + right; }
|
|
|
|
template<typename T1> be_t& operator -= (T1 right) { return *this = T(*this) - right; }
|
|
|
|
template<typename T1> be_t& operator *= (T1 right) { return *this = T(*this) * right; }
|
|
|
|
template<typename T1> be_t& operator /= (T1 right) { return *this = T(*this) / right; }
|
|
|
|
template<typename T1> be_t& operator %= (T1 right) { return *this = T(*this) % right; }
|
|
|
|
template<typename T1> be_t& operator &= (T1 right) { return *this = T(*this) & right; }
|
|
|
|
template<typename T1> be_t& operator |= (T1 right) { return *this = T(*this) | right; }
|
|
|
|
template<typename T1> be_t& operator ^= (T1 right) { return *this = T(*this) ^ right; }
|
|
|
|
template<typename T1> be_t& operator <<= (T1 right) { return *this = T(*this) << right; }
|
|
|
|
template<typename T1> be_t& operator >>= (T1 right) { return *this = T(*this) >> right; }
|
|
|
|
|
|
|
|
template<typename T1> be_t& operator += (const be_t<T1>& right) { return *this = ToLE() + right.ToLE(); }
|
|
|
|
template<typename T1> be_t& operator -= (const be_t<T1>& right) { return *this = ToLE() - right.ToLE(); }
|
|
|
|
template<typename T1> be_t& operator *= (const be_t<T1>& right) { return *this = ToLE() * right.ToLE(); }
|
|
|
|
template<typename T1> be_t& operator /= (const be_t<T1>& right) { return *this = ToLE() / right.ToLE(); }
|
|
|
|
template<typename T1> be_t& operator %= (const be_t<T1>& right) { return *this = ToLE() % right.ToLE(); }
|
|
|
|
template<typename T1> be_t& operator &= (const be_t<T1>& right) { return *this = ToBE() & right.ToBE(); }
|
|
|
|
template<typename T1> be_t& operator |= (const be_t<T1>& right) { return *this = ToBE() | right.ToBE(); }
|
|
|
|
template<typename T1> be_t& operator ^= (const be_t<T1>& right) { return *this = ToBE() ^ right.ToBE(); }
|
|
|
|
|
|
|
|
template<typename T1> be_t operator & (const be_t<T1>& right) const { be_t<T> res; res.FromBE(ToBE() & right.ToBE()); return res; }
|
|
|
|
template<typename T1> be_t operator | (const be_t<T1>& right) const { be_t<T> res; res.FromBE(ToBE() | right.ToBE()); return res; }
|
|
|
|
template<typename T1> be_t operator ^ (const be_t<T1>& right) const { be_t<T> res; res.FromBE(ToBE() ^ right.ToBE()); return res; }
|
|
|
|
|
2013-11-16 01:38:22 +01:00
|
|
|
template<typename T1> bool operator == (T1 right) const { return (T1)ToLE() == right; }
|
2013-10-06 14:07:42 +02:00
|
|
|
template<typename T1> bool operator != (T1 right) const { return !(*this == right); }
|
2013-11-16 01:38:22 +01:00
|
|
|
template<typename T1> bool operator > (T1 right) const { return (T1)ToLE() > right; }
|
|
|
|
template<typename T1> bool operator < (T1 right) const { return (T1)ToLE() < right; }
|
|
|
|
template<typename T1> bool operator >= (T1 right) const { return (T1)ToLE() >= right; }
|
|
|
|
template<typename T1> bool operator <= (T1 right) const { return (T1)ToLE() <= right; }
|
2013-10-06 14:07:42 +02:00
|
|
|
|
|
|
|
template<typename T1> bool operator == (const be_t<T1>& right) const { return ToBE() == right.ToBE(); }
|
|
|
|
template<typename T1> bool operator != (const be_t<T1>& right) const { return !(*this == right); }
|
2013-11-16 01:38:22 +01:00
|
|
|
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(); }
|
|
|
|
template<typename T1> bool operator <= (const be_t<T1>& right) const { return (T1)ToLE() <= right.ToLE(); }
|
2014-02-22 03:53:06 +01:00
|
|
|
|
|
|
|
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; }
|
2013-11-19 22:10:23 +01:00
|
|
|
};
|
2014-02-22 03:53:06 +01:00
|
|
|
|
2014-09-04 11:21:23 +02:00
|
|
|
template<typename T, typename T2>
|
|
|
|
class be_t<const T, T2>
|
|
|
|
{
|
|
|
|
static_assert(sizeof(T2) == 1 || sizeof(T2) == 2 || sizeof(T2) == 4 || sizeof(T2) == 8, "Bad be_t type");
|
|
|
|
const T m_data;
|
|
|
|
|
|
|
|
public:
|
|
|
|
typedef const T type;
|
|
|
|
|
|
|
|
const T& ToBE() const
|
|
|
|
{
|
|
|
|
return m_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
const T ToLE() const
|
|
|
|
{
|
|
|
|
return se_t<const T, sizeof(T2)>::func(m_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static be_t MakeFromLE(const T value)
|
|
|
|
{
|
|
|
|
const T data = se_t<const T, sizeof(T2)>::func(value);
|
|
|
|
return (be_t&)data;
|
|
|
|
}
|
|
|
|
|
|
|
|
static be_t MakeFromBE(const T value)
|
|
|
|
{
|
|
|
|
return (be_t&)value;
|
|
|
|
}
|
|
|
|
|
|
|
|
//template<typename T1>
|
|
|
|
operator const T() const
|
|
|
|
{
|
|
|
|
return ToLE();
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T1>
|
|
|
|
operator const be_t<T1>() const
|
|
|
|
{
|
|
|
|
if (sizeof(T1) > sizeof(T) || std::is_floating_point<T>::value || std::is_floating_point<T1>::value)
|
|
|
|
{
|
|
|
|
T1 res = se_t<T1, sizeof(T1)>::func(ToLE());
|
|
|
|
return (be_t<T1>&)res;
|
|
|
|
}
|
|
|
|
else if (sizeof(T1) < sizeof(T))
|
|
|
|
{
|
|
|
|
T1 res = ToBE() >> ((sizeof(T) - sizeof(T1)) * 8);
|
|
|
|
return (be_t<T1>&)res;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
T1 res = ToBE();
|
|
|
|
return (be_t<T1>&)res;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T1> be_t operator & (const be_t<T1>& right) const { const T res; res = ToBE() & right.ToBE(); return (be_t&)res; }
|
|
|
|
template<typename T1> be_t operator | (const be_t<T1>& right) const { const T res; res = ToBE() | right.ToBE(); return (be_t&)res; }
|
|
|
|
template<typename T1> be_t operator ^ (const be_t<T1>& right) const { const T res; res = ToBE() ^ right.ToBE(); return (be_t&)res; }
|
|
|
|
|
|
|
|
template<typename T1> bool operator == (T1 right) const { return (T1)ToLE() == right; }
|
|
|
|
template<typename T1> bool operator != (T1 right) const { return !(*this == right); }
|
|
|
|
template<typename T1> bool operator > (T1 right) const { return (T1)ToLE() > right; }
|
|
|
|
template<typename T1> bool operator < (T1 right) const { return (T1)ToLE() < right; }
|
|
|
|
template<typename T1> bool operator >= (T1 right) const { return (T1)ToLE() >= right; }
|
|
|
|
template<typename T1> bool operator <= (T1 right) const { return (T1)ToLE() <= right; }
|
|
|
|
|
|
|
|
template<typename T1> bool operator == (const be_t<T1>& right) const { return ToBE() == right.ToBE(); }
|
|
|
|
template<typename T1> bool operator != (const be_t<T1>& right) const { return !(*this == right); }
|
|
|
|
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(); }
|
|
|
|
template<typename T1> bool operator <= (const be_t<T1>& right) const { return (T1)ToLE() <= right.ToLE(); }
|
|
|
|
};
|
|
|
|
|
2014-09-01 18:16:44 +02:00
|
|
|
template<typename T, typename T2 = T>
|
|
|
|
struct is_be_t : public std::integral_constant<bool, false> {};
|
|
|
|
|
|
|
|
template<typename T, typename T2>
|
2014-09-01 23:22:07 +02:00
|
|
|
struct is_be_t<be_t<T, T2>, T2> : public std::integral_constant<bool, true> {};
|
2014-09-01 18:16:44 +02:00
|
|
|
|
2014-09-01 23:22:07 +02:00
|
|
|
template<typename T, typename T2 = T>
|
2014-09-01 18:16:44 +02:00
|
|
|
struct remove_be_t
|
|
|
|
{
|
|
|
|
typedef T type;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T, typename T2>
|
|
|
|
struct remove_be_t<be_t<T, T2>>
|
|
|
|
{
|
|
|
|
typedef T type;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T, typename T2 = T>
|
|
|
|
class to_be_t
|
|
|
|
{
|
2014-09-01 18:45:22 +02:00
|
|
|
template<typename TT, typename TT2, bool is_need_swap>
|
2014-09-01 18:16:44 +02:00
|
|
|
struct _be_type_selector
|
|
|
|
{
|
2014-09-01 19:38:55 +02:00
|
|
|
typedef TT type;
|
2014-09-01 18:16:44 +02:00
|
|
|
};
|
|
|
|
|
2014-09-01 18:45:22 +02:00
|
|
|
template<typename TT, typename TT2>
|
|
|
|
struct _be_type_selector<TT, TT2, true>
|
2014-09-01 18:16:44 +02:00
|
|
|
{
|
2014-09-01 19:38:55 +02:00
|
|
|
typedef be_t<TT, TT2> type;
|
2014-09-01 18:16:44 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
//true if need swap endianes for be
|
|
|
|
static const bool value = (sizeof(T2) > 1) && std::is_arithmetic<T>::value;
|
|
|
|
|
|
|
|
//be_t<T, size> if need swap endianes, T otherwise
|
|
|
|
typedef typename _be_type_selector< T, T2, value >::type type;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
class to_be_t<T, void>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//true if need swap endianes for be
|
|
|
|
static const bool value = false;
|
|
|
|
|
|
|
|
//be_t<T, size> if need swap endianes, T otherwise
|
|
|
|
typedef void type;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
class to_be_t<T, const void>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//true if need swap endianes for be
|
|
|
|
static const bool value = false;
|
|
|
|
|
|
|
|
//be_t<T, size> if need swap endianes, T otherwise
|
2014-09-02 14:18:50 +02:00
|
|
|
typedef const void type;
|
2014-09-01 18:16:44 +02:00
|
|
|
};
|
|
|
|
|
2014-02-22 03:53:06 +01:00
|
|
|
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
|
2014-08-25 16:56:13 +02:00
|
|
|
|
|
|
|
template<typename T> __forceinline static u8 Read8(T& f)
|
|
|
|
{
|
|
|
|
u8 ret;
|
|
|
|
f.Read(&ret, sizeof(ret));
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T> __forceinline static u16 Read16(T& f)
|
|
|
|
{
|
|
|
|
be_t<u16> ret;
|
|
|
|
f.Read(&ret, sizeof(ret));
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T> __forceinline static u32 Read32(T& f)
|
|
|
|
{
|
|
|
|
be_t<u32> ret;
|
|
|
|
f.Read(&ret, sizeof(ret));
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T> __forceinline static u64 Read64(T& f)
|
|
|
|
{
|
|
|
|
be_t<u64> ret;
|
|
|
|
f.Read(&ret, sizeof(ret));
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T> __forceinline static u16 Read16LE(T& f)
|
|
|
|
{
|
|
|
|
u16 ret;
|
|
|
|
f.Read(&ret, sizeof(ret));
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T> __forceinline static u32 Read32LE(T& f)
|
|
|
|
{
|
|
|
|
u32 ret;
|
|
|
|
f.Read(&ret, sizeof(ret));
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T> __forceinline static u64 Read64LE(T& f)
|
|
|
|
{
|
|
|
|
u64 ret;
|
|
|
|
f.Read(&ret, sizeof(ret));
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T> __forceinline static void Write8(T& f, const u8 data)
|
|
|
|
{
|
|
|
|
f.Write(&data, sizeof(data));
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T> __forceinline static void Write16LE(T& f, const u16 data)
|
|
|
|
{
|
|
|
|
f.Write(&data, sizeof(data));
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T> __forceinline static void Write32LE(T& f, const u32 data)
|
|
|
|
{
|
|
|
|
f.Write(&data, sizeof(data));
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T> __forceinline static void Write64LE(T& f, const u64 data)
|
|
|
|
{
|
|
|
|
f.Write(&data, sizeof(data));
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T> __forceinline static void Write16(T& f, const u16 data)
|
|
|
|
{
|
|
|
|
Write16LE(f, re16(data));
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T> __forceinline static void Write32(T& f, const u32 data)
|
|
|
|
{
|
|
|
|
Write32LE(f, re32(data));
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T> __forceinline static void Write64(T& f, const u64 data)
|
|
|
|
{
|
|
|
|
Write64LE(f, re64(data));
|
|
|
|
}
|