X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmath%2FFixed.h;h=7a5e13d5fa9f2f1f6c891c0dfc2fb9467de50dff;hb=b9e715649b41cb69ea1b2d2a588522541eb87b46;hp=a3982755dea86c8d147229fe0e19c33fb1caf2e4;hpb=06db9f596cd1c5aa4c0832b387882f7c74c1b4c0;p=l2e.git diff --git a/src/math/Fixed.h b/src/math/Fixed.h index a398275..7a5e13d 100644 --- a/src/math/Fixed.h +++ b/src/math/Fixed.h @@ -51,7 +51,7 @@ public: public: int Int() const { return IntPart() * Sigma(); } int Sigma() const { - if (IntPart() == 0 && FracPart() == 0) { + if (RawInt() == 0) { return 0; } else if (SignPart() == 0) { return 1; @@ -96,7 +96,8 @@ public: } return *this; } - Fixed &operator +=(int i) { + template + Fixed &operator +=(Scalar i) { Sint32 temp = SignedInt() + (i << IntShift()); if (temp < 0) { rep = (temp * -1) | SignMask(); @@ -114,7 +115,8 @@ public: } return *this; } - Fixed &operator -=(int i) { + template + Fixed &operator -=(Scalar i) { Sint32 temp = SignedInt() - (i << IntShift()); if (temp < 0) { rep = (temp * -1) | SignMask(); @@ -134,7 +136,8 @@ public: } return *this; } - Fixed &operator *=(int i) { + template + Fixed &operator *=(Scalar i) { Sint32 temp = SignedInt() * i; if (temp < 0) { rep = (temp * -1) | SignMask(); @@ -154,7 +157,8 @@ public: } return *this; } - Fixed &operator /=(int i) { + template + Fixed &operator /=(Scalar i) { Sint32 temp = SignedInt() / i; if (temp < 0) { rep = (temp * -1) | SignMask();