From cbcb2c5de164c5f917401a84410d1aaa82005307 Mon Sep 17 00:00:00 2001 From: Adrian Conlon Date: Wed, 29 Dec 2021 11:40:37 +0000 Subject: [PATCH] Use the "<=>" operator in the register16_t class to give comparison operators for free. --- inc/Register.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/Register.h b/inc/Register.h index 3e03a16..89cc47e 100644 --- a/inc/Register.h +++ b/inc/Register.h @@ -74,8 +74,8 @@ namespace EightBit { return lhs.word == rhs.word; } - [[nodiscard]] constexpr inline auto operator!=(const register16_t lhs, const register16_t rhs) noexcept { - return !(lhs == rhs); + [[nodiscard]] constexpr auto operator<=>(const register16_t lhs, const register16_t rhs) noexcept { + return lhs.word <=> rhs.word; } [[nodiscard]] constexpr inline auto operator+(register16_t lhs, const register16_t rhs) noexcept {