diff --git a/include/gfx/rgba.hpp b/include/gfx/rgba.hpp index be0ea510..6b0a8a77 100644 --- a/include/gfx/rgba.hpp +++ b/include/gfx/rgba.hpp @@ -36,8 +36,9 @@ struct Rgba { auto shl = [](uint8_t val, unsigned shift) { return static_cast(val) << shift; }; return shl(red, 24) | shl(green, 16) | shl(blue, 8) | shl(alpha, 0); } + bool operator==(Rgba const &rhs) const { return toCSS() == rhs.toCSS(); } - bool operator!=(Rgba const &rhs) const { return toCSS() != rhs.toCSS(); } + bool operator!=(Rgba const &rhs) const { return !operator==(rhs); } // CGB colors are RGB555, so we use bit 15 to signify that the color is transparent instead // Since the rest of the bits don't matter then, we return 0x8000 exactly. diff --git a/include/itertools.hpp b/include/itertools.hpp index 4629b521..581f77bc 100644 --- a/include/itertools.hpp +++ b/include/itertools.hpp @@ -25,7 +25,7 @@ class EnumSeq { auto operator*() const { return _value; } bool operator==(Iterator const &rhs) const { return _value == rhs._value; } - bool operator!=(Iterator const &rhs) const { return _value != rhs._value; } + bool operator!=(Iterator const &rhs) const { return !operator==(rhs); } }; public: @@ -59,10 +59,7 @@ public: bool operator==(ZipIterator const &rhs) const { return std::get<0>(_iters) == std::get<0>(rhs._iters); } - - bool operator!=(ZipIterator const &rhs) const { - return std::get<0>(_iters) != std::get<0>(rhs._iters); - } + bool operator!=(ZipIterator const &rhs) const { return !operator==(rhs); } }; template diff --git a/src/gfx/pal_packing.cpp b/src/gfx/pal_packing.cpp index 869299c2..6a33e636 100644 --- a/src/gfx/pal_packing.cpp +++ b/src/gfx/pal_packing.cpp @@ -86,8 +86,9 @@ private: public: Iter() = default; - bool operator==(Iter const &other) const { return _iter == other._iter; } - bool operator!=(Iter const &other) const { return !(*this == other); } + bool operator==(Iter const &rhs) const { return _iter == rhs._iter; } + bool operator!=(Iter const &rhs) const { return !operator==(rhs); } + Iter &operator++() { ++_iter; skipEmpty(); @@ -98,6 +99,7 @@ private: ++(*this); return it; } + reference operator*() const { assume((*_iter).has_value()); return **_iter; diff --git a/src/gfx/process.cpp b/src/gfx/process.cpp index 646a49f9..f1fe5a22 100644 --- a/src/gfx/process.cpp +++ b/src/gfx/process.cpp @@ -466,7 +466,7 @@ public: } bool operator==(Iterator const &rhs) const { return coords() == rhs.coords(); } - bool operator!=(Iterator const &rhs) const { return coords() != rhs.coords(); } + bool operator!=(Iterator const &rhs) const { return !operator==(rhs); } }; public: