From affd77ea77860fa9231aba8e43ad95dea06a114a Mon Sep 17 00:00:00 2001 From: Nilay Vaish Date: Sun, 10 Feb 2013 21:26:23 -0600 Subject: base: add some mathematical operators to Cycles class --- src/base/types.hh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/base') diff --git a/src/base/types.hh b/src/base/types.hh index 7f4375048..b4cb69a0c 100644 --- a/src/base/types.hh +++ b/src/base/types.hh @@ -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 }; -- cgit v1.2.3