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;
}
return *this;
}
- Fixed &operator +=(int i) {
+ template<class Scalar>
+ Fixed &operator +=(Scalar i) {
Sint32 temp = SignedInt() + (i << IntShift());
if (temp < 0) {
rep = (temp * -1) | SignMask();
}
return *this;
}
- Fixed &operator -=(int i) {
+ template<class Scalar>
+ Fixed &operator -=(Scalar i) {
Sint32 temp = SignedInt() - (i << IntShift());
if (temp < 0) {
rep = (temp * -1) | SignMask();
}
return *this;
}
- Fixed &operator *=(int i) {
+ template<class Scalar>
+ Fixed &operator *=(Scalar i) {
Sint32 temp = SignedInt() * i;
if (temp < 0) {
rep = (temp * -1) | SignMask();
}
return *this;
}
- Fixed &operator /=(int i) {
+ template<class Scalar>
+ Fixed &operator /=(Scalar i) {
Sint32 temp = SignedInt() / i;
if (temp < 0) {
rep = (temp * -1) | SignMask();