Further simplify IntType struct defs
This commit is contained in:
parent
2cb08458f6
commit
01c01618e9
|
@ -354,18 +354,20 @@ template <typename Type>
|
||||||
class BEInt<Type, 2>
|
class BEInt<Type, 2>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline void put (Type i) { hb_be_uint16_put (v,i); }
|
inline class BEInt<Type,2>& operator = (Type i) { hb_be_uint16_put (v,i); return *this; }
|
||||||
inline Type get () const { return hb_be_uint16_get (v); }
|
inline operator Type () const { return hb_be_uint16_get (v); }
|
||||||
inline bool cmp (const BEInt<Type, 2> o) const { return hb_be_uint16_cmp (v, o.v); }
|
inline bool operator == (const BEInt<Type, 2>& o) const { return hb_be_uint16_cmp (v, o.v); }
|
||||||
|
inline bool operator != (const BEInt<Type, 2>& o) const { return !(*this == o); }
|
||||||
private: uint8_t v[2];
|
private: uint8_t v[2];
|
||||||
};
|
};
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
class BEInt<Type, 4>
|
class BEInt<Type, 4>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline void put (Type i) { hb_be_uint32_put (v,i); }
|
inline class BEInt<Type,4>& operator = (Type i) { hb_be_uint32_put (v,i); return *this; }
|
||||||
inline Type get () const { return hb_be_uint32_get (v); }
|
inline operator Type () const { return hb_be_uint32_get (v); }
|
||||||
inline bool cmp (const BEInt<Type, 4> o) const { return hb_be_uint32_cmp (v, o.v); }
|
inline bool operator == (const BEInt<Type, 4>& o) const { return hb_be_uint32_cmp (v, o.v); }
|
||||||
|
inline bool operator != (const BEInt<Type, 4>& o) const { return !(*this == o); }
|
||||||
private: uint8_t v[4];
|
private: uint8_t v[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -373,9 +375,10 @@ template <typename Type>
|
||||||
struct IntType
|
struct IntType
|
||||||
{
|
{
|
||||||
static inline unsigned int get_size () { return sizeof (Type); }
|
static inline unsigned int get_size () { return sizeof (Type); }
|
||||||
inline void set (Type i) { v.put (i); }
|
inline void set (Type i) { v = i; }
|
||||||
inline operator Type(void) const { return v.get (); }
|
inline operator Type(void) const { return v; }
|
||||||
inline bool operator == (const IntType<Type> &o) const { return v.cmp (o.v); }
|
inline bool operator == (const IntType<Type> &o) const { return v == o.v; }
|
||||||
|
inline bool operator != (const IntType<Type> &o) const { return v != o.v; }
|
||||||
inline bool sanitize (SANITIZE_ARG_DEF) {
|
inline bool sanitize (SANITIZE_ARG_DEF) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
return SANITIZE_SELF ();
|
return SANITIZE_SELF ();
|
||||||
|
|
Loading…
Reference in New Issue