mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-01-15 12:30:51 +00:00
Spaceship operator didn't work as a I wanted it, so I've gone old school again until I can work out why the "==" operator couldn't be found.
This commit is contained in:
parent
bde2900017
commit
42e72ce077
@ -68,28 +68,15 @@ namespace EightBit {
|
|||||||
this->word -= rhs.word;
|
this->word -= rhs.word;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] constexpr auto operator==(const register16_t& rhs) const noexcept { return word == rhs.word; }
|
||||||
|
[[nodiscard]] constexpr auto operator!=(const register16_t& rhs) const noexcept { return word != rhs.word; }
|
||||||
|
[[nodiscard]] constexpr auto operator<(const register16_t& rhs) const noexcept { return word < rhs.word; }
|
||||||
|
[[nodiscard]] constexpr auto operator<=(const register16_t& rhs) const noexcept { return word <= rhs.word; }
|
||||||
|
[[nodiscard]] constexpr auto operator>(const register16_t& rhs) const noexcept { return word > rhs.word; }
|
||||||
|
[[nodiscard]] constexpr auto operator>=(const register16_t& rhs) const noexcept { return word >= rhs.word; }
|
||||||
};
|
};
|
||||||
|
|
||||||
[[nodiscard]] constexpr inline auto operator==(const register16_t lhs, const register16_t rhs) noexcept {
|
|
||||||
return lhs.word == rhs.word;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if __cplusplus >= 202002L
|
|
||||||
[[nodiscard]] constexpr auto operator<=>(const register16_t lhs, const register16_t rhs) noexcept {
|
|
||||||
return lhs.word <=> rhs.word;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr inline auto operator!=(const register16_t lhs, const register16_t rhs) noexcept {
|
|
||||||
return lhs.word != rhs.word;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr inline auto operator>(const register16_t lhs, const register16_t rhs) noexcept {
|
|
||||||
return lhs.word > rhs.word;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr inline auto operator+(register16_t lhs, const register16_t rhs) noexcept {
|
[[nodiscard]] constexpr inline auto operator+(register16_t lhs, const register16_t rhs) noexcept {
|
||||||
lhs += rhs;
|
lhs += rhs;
|
||||||
return lhs;
|
return lhs;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user