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:
Adrian Conlon 2022-01-02 12:29:39 +00:00
parent bde2900017
commit 42e72ce077

View File

@ -68,28 +68,15 @@ namespace EightBit {
this->word -= rhs.word;
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 {
lhs += rhs;
return lhs;