Add fixed point assignment operators
This commit is contained in:
parent
d0557bad3e
commit
cc7c346f84
@ -105,12 +105,20 @@ public:
|
||||
constexpr fixed operator+(fixed rhs) const {
|
||||
return from_raw(x + rhs.x);
|
||||
}
|
||||
constexpr fixed& operator+=(fixed rhs) {
|
||||
x += rhs.x;
|
||||
return *this;
|
||||
}
|
||||
/**
|
||||
* \brief Fixed point subtraction
|
||||
*/
|
||||
constexpr fixed operator-(fixed rhs) const {
|
||||
return from_raw(x - rhs.x);
|
||||
}
|
||||
constexpr fixed& operator-=(fixed rhs) {
|
||||
x -= rhs.x;
|
||||
return *this;
|
||||
}
|
||||
constexpr fixed operator-() const {
|
||||
return from_raw(-x);
|
||||
}
|
||||
@ -135,6 +143,10 @@ public:
|
||||
|
||||
return from_raw(raw_result);
|
||||
}
|
||||
fixed& operator*=(fixed rhs) {
|
||||
*this = *this * rhs;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Fixed point division
|
||||
@ -152,6 +164,10 @@ public:
|
||||
* Placed in IWRAM
|
||||
*/
|
||||
fixed operator/(fixed rhs) const;
|
||||
fixed& operator/=(fixed rhs) {
|
||||
*this = *this / rhs;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace mtl
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user