From: Nilay Vaish Date: Mon, 11 Feb 2013 03:26:23 +0000 (-0600) Subject: base: add some mathematical operators to Cycles class X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=affd77ea77860fa9231aba8e43ad95dea06a114a;p=gem5.git base: add some mathematical operators to Cycles class --- 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 };