diff --git a/src/frontend/A64/imm.h b/src/frontend/A64/imm.h index 9b33ab2e..eff6c397 100644 --- a/src/frontend/A64/imm.h +++ b/src/frontend/A64/imm.h @@ -51,12 +51,28 @@ public: return static_cast(Common::Bits(value)); } - bool operator==(const Imm& other) const { + bool operator==(Imm other) const { return value == other.value; } - bool operator!=(const Imm& other) const { - return value != other.value; + bool operator!=(Imm other) const { + return !operator==(other); + } + + bool operator<(Imm other) const { + return value < other.value; + } + + bool operator<=(Imm other) const { + return value <= other.value; + } + + bool operator>(Imm other) const { + return value > other.value; + } + + bool operator>=(Imm other) const { + return value >= other.value; } private: @@ -67,23 +83,63 @@ private: }; template -bool operator==(u32 a, const Imm& b) { +bool operator==(u32 a, Imm b) { return Imm{a} == b; } template -bool operator==(const Imm& a, u32 b) { +bool operator==(Imm a, u32 b) { return Imm{b} == a; } template -bool operator!=(u32 a, const Imm& b) { - return Imm{a} != b; +bool operator!=(u32 a, Imm b) { + return !operator==(a, b); } template -bool operator!=(const Imm& a, u32 b) { - return Imm{b} != a; +bool operator!=(Imm a, u32 b) { + return !operator==(a, b); +} + +template +bool operator<(u32 a, Imm b) { + return Imm{a} < b; +} + +template +bool operator<(Imm a, u32 b) { + return a < Imm{b}; +} + +template +bool operator<=(u32 a, Imm b) { + return !operator<(b, a); +} + +template +bool operator<=(Imm a, u32 b) { + return !operator<(b, a); +} + +template +bool operator>(u32 a, Imm b) { + return operator<(b, a); +} + +template +bool operator>(Imm a, u32 b) { + return operator<(b, a); +} + +template +bool operator>=(u32 a, Imm b) { + return !operator<(a, b); +} + +template +bool operator>=(Imm a, u32 b) { + return !operator<(a, b); } /**