aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruruk2014-06-28 21:39:16 +0200
committeruruk2014-06-28 21:39:16 +0200
commit2f80cf6faf10e6e10728a19a72c414587b14cd26 (patch)
tree0093b8ff2af364c61eb6059e7b9cb38238e2b910
parentf69ee470ed7d28d4dfd31b7339c7b4a160e52543 (diff)
downloadscummvm-rg350-2f80cf6faf10e6e10728a19a72c414587b14cd26.tar.gz
scummvm-rg350-2f80cf6faf10e6e10728a19a72c414587b14cd26.tar.bz2
scummvm-rg350-2f80cf6faf10e6e10728a19a72c414587b14cd26.zip
CGE2: Fix formatting of FXP's operators.
-rw-r--r--engines/cge2/vga13h.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/engines/cge2/vga13h.h b/engines/cge2/vga13h.h
index 9d26bd8f74..6c68c8cf07 100644
--- a/engines/cge2/vga13h.h
+++ b/engines/cge2/vga13h.h
@@ -68,10 +68,10 @@ class FXP { // fixed point
public:
FXP (void): f(0), i(0) { }
FXP (int i0, int f0 = 0) : i(i0), f(0) { }
- FXP& operator = (const int& x) { i = x; f = 0; return *this; }
- FXP operator + (const FXP& x) const { FXP y; y.setJoined(getJoined() + x.getJoined()); return y; }
- FXP operator - (const FXP& x) const { FXP y; y.setJoined(getJoined() - x.getJoined()); return y; }
- FXP operator * (const FXP& x) const {
+ FXP& operator=(const int& x) { i = x; f = 0; return *this; }
+ FXP operator+(const FXP& x) const { FXP y; y.setJoined(getJoined() + x.getJoined()); return y; }
+ FXP operator-(const FXP& x) const { FXP y; y.setJoined(getJoined() - x.getJoined()); return y; }
+ FXP operator*(const FXP& x) const {
FXP y; long t;
y.i = i * x.i;
t = ((long) f * x.f) >> 16;
@@ -80,7 +80,7 @@ public:
y.i += t >> 16;
return y;
}
- FXP operator / (const FXP& x) const {
+ FXP operator/(const FXP& x) const {
FXP y; bool sign = false;
if (!x.empty()) {
long j = getJoined(), jx = x.getJoined();
@@ -104,14 +104,14 @@ public:
return y;
}
//int& operator = (int& a, const FXP& b) { return a = b.i; }
- friend int& operator += (int& a, const FXP& b) { return a += b.i; }
- friend int& operator -= (int& a, const FXP& b) { return a -= b.i; }
- friend FXP& operator += (FXP& a, const int& b) { a.i += b; return a; }
- friend FXP& operator -= (FXP& a, const int& b) { a.i -= b; return a; }
- friend bool operator == (const FXP &a, const FXP &b) { return (a.i == b.i) && (a.f == b.f); }
- friend bool operator != (const FXP &a, const FXP &b) { return (a.i != b.i) || (a.f != b.f); }
- friend bool operator < (const FXP &a, const FXP &b) { return (a.i < b.i) || ((a.i == b.i) && (a.f < b.f)); }
- friend bool operator > (const FXP &a, const FXP &b) { return (a.i > b.i) || ((a.i == b.i) && (a.f > b.f)); }
+ friend int& operator+=(int& a, const FXP& b) { return a += b.i; }
+ friend int& operator-=(int& a, const FXP& b) { return a -= b.i; }
+ friend FXP& operator+=(FXP& a, const int& b) { a.i += b; return a; }
+ friend FXP& operator-=(FXP& a, const int& b) { a.i -= b; return a; }
+ friend bool operator==(const FXP &a, const FXP &b) { return (a.i == b.i) && (a.f == b.f); }
+ friend bool operator!=(const FXP &a, const FXP &b) { return (a.i != b.i) || (a.f != b.f); }
+ friend bool operator<(const FXP &a, const FXP &b) { return (a.i < b.i) || ((a.i == b.i) && (a.f < b.f)); }
+ friend bool operator>(const FXP &a, const FXP &b) { return (a.i > b.i) || ((a.i == b.i) && (a.f > b.f)); }
int trunc(void) const { return i; }
int round(void) const { return i + (f > 0x7FFF); }
bool empty() const { return i == 0 && f == 0; }