hecl/FourCC: Implement operator!= in terms of operator==

Deduplicates the amount of written code. Now code only needs to ever
change in operator== to automatically reflect across the two functions.
This commit is contained in:
Lioncash 2019-08-15 06:01:12 -04:00
parent 06c436b68d
commit 1382bbf365
1 changed files with 3 additions and 3 deletions

View File

@ -33,15 +33,15 @@ public:
constexpr FourCC& operator=(FourCC&&) noexcept = default;
bool operator==(const FourCC& other) const { return num == other.num; }
bool operator!=(const FourCC& other) const { return num != other.num; }
bool operator!=(const FourCC& other) const { return !operator==(other); }
bool operator==(const char* other) const {
return std::memcmp(fcc, other, sizeof(fcc)) == 0;
}
bool operator!=(const char* other) const { return !operator==(other); }
bool operator==(int32_t other) const { return num == uint32_t(other); }
bool operator!=(int32_t other) const { return num != uint32_t(other); }
bool operator!=(int32_t other) const { return !operator==(other); }
bool operator==(uint32_t other) const { return num == other; }
bool operator!=(uint32_t other) const { return num != other; }
bool operator!=(uint32_t other) const { return !operator==(other); }
std::string toString() const { return std::string(fcc, 4); }
uint32_t toUint32() const { return num; }