Add arithmetic operators to IntType<>

This commit is contained in:
Behdad Esfahbod 2019-08-28 13:49:17 -07:00
parent 2e1d00c85b
commit 307bd6d79f
1 changed files with 8 additions and 0 deletions

View File

@ -63,6 +63,14 @@ struct IntType
operator wide_type () const { return v; }
bool operator == (const IntType &o) const { return (Type) v == (Type) o.v; }
bool operator != (const IntType &o) const { return !(*this == o); }
IntType& operator += (unsigned count) { *this = *this + count; return *this; }
IntType& operator -= (unsigned count) { *this = *this - count; return *this; }
IntType& operator ++ () { *this += 1; return *this; }
IntType& operator -- () { *this -= 1; return *this; }
IntType operator ++ (int) { IntType c (*this); ++*this; return c; }
IntType operator -- (int) { IntType c (*this); --*this; return c; }
HB_INTERNAL static int cmp (const IntType *a, const IntType *b)
{ return b->cmp (*a); }
template <typename Type2>