Skip to content

Commit

Permalink
base: add some mathematical operators to Cycles class
Browse files Browse the repository at this point in the history
  • Loading branch information
nilayvaish committed Feb 11, 2013
1 parent bc1daae commit affd77e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/base/types.hh
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,18 @@ class Cycles
bool operator>(const Cycles& cc) const
{ return c > cc.c; }

const Cycles operator +(const Cycles& b) const
{ return Cycles(c + b.c); }

const Cycles operator -(const Cycles& b) const
{ assert(c >= b.c); return Cycles(c - b.c); }

const Cycles operator <<(const int32_t shift)
{ return Cycles(c << shift); }

const Cycles operator >>(const int32_t shift)
{ return Cycles(c >> shift); }

#endif // SWIG not touching operators

};
Expand Down

0 comments on commit affd77e

Please sign in to comment.