diff options
author | Yotam Barnoy | 2010-10-31 11:08:43 +0000 |
---|---|---|
committer | Yotam Barnoy | 2010-10-31 11:08:43 +0000 |
commit | 94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1 (patch) | |
tree | 3df2a4ae7967c56d464729669fc06ce4e93dff36 /common/rational.cpp | |
parent | 8df4278ba8cfbf71228e1927f9db635a9a30a57f (diff) | |
parent | dca3c8d8bfc6c4db38cf8e8291818dd472041d4e (diff) | |
download | scummvm-rg350-94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1.tar.gz scummvm-rg350-94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1.tar.bz2 scummvm-rg350-94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1.zip |
Updated with latest from trunk
svn-id: r53976
Diffstat (limited to 'common/rational.cpp')
-rw-r--r-- | common/rational.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/common/rational.cpp b/common/rational.cpp index 163044f349..f55c2dcfe3 100644 --- a/common/rational.cpp +++ b/common/rational.cpp @@ -22,6 +22,7 @@ * $Id$ */ +#include "common/debug.h" #include "common/rational.h" #include "common/util.h" #include "common/algorithm.h" @@ -257,38 +258,34 @@ frac_t Rational::toFrac() const { return (_num * FRAC_ONE) / _denom; } -Rational::operator int() const { - return toInt(); -} - -Rational::operator double() const { - return toDouble(); -} - const Rational operator+(int left, const Rational &right) { - Rational tmp = right; - tmp += left; + Rational tmp(left); + tmp += right; return tmp; } const Rational operator-(int left, const Rational &right) { - Rational tmp = right; - tmp -= left; + Rational tmp(left); + tmp -= right; return tmp; } const Rational operator*(int left, const Rational &right) { - Rational tmp = right; - tmp *= left; + Rational tmp(left); + tmp *= right; return tmp; } const Rational operator/(int left, const Rational &right) { - Rational tmp = right; - tmp /= left; + Rational tmp(left); + tmp /= right; return tmp; } +void Rational::debugPrint(int debuglevel, const char *caption) const { + debug(debuglevel, "%s %d/%d", caption, _num, _denom); +} + bool operator==(int left, const Rational &right) { return right == left; } |