Make BYTE a real type

This commit is contained in:
Behdad Esfahbod 2015-08-21 12:44:36 +01:00
parent ed6962c795
commit 0299b45000
1 changed files with 15 additions and 1 deletions

View File

@ -535,6 +535,20 @@ struct Supplier
template <typename Type, int Bytes> struct BEInt;
template <typename Type>
struct BEInt<Type, 1>
{
public:
inline void set (Type V)
{
v = V;
}
inline operator Type (void) const
{
return v;
}
private: uint8_t v;
};
template <typename Type>
struct BEInt<Type, 2>
{
@ -618,7 +632,7 @@ struct IntType
DEFINE_SIZE_STATIC (Size);
};
typedef uint8_t BYTE; /* 8-bit unsigned integer. */
typedef IntType<uint8_t , 1> BYTE; /* 8-bit unsigned integer. */
typedef IntType<uint16_t, 2> USHORT; /* 16-bit unsigned integer. */
typedef IntType<int16_t, 2> SHORT; /* 16-bit signed integer. */
typedef IntType<uint32_t, 4> ULONG; /* 32-bit unsigned integer. */