mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-07-13 18:45:52 +00:00
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:
parent
06c436b68d
commit
1382bbf365
@ -33,15 +33,15 @@ public:
|
|||||||
constexpr FourCC& operator=(FourCC&&) noexcept = default;
|
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 num != other.num; }
|
bool operator!=(const FourCC& other) const { return !operator==(other); }
|
||||||
bool operator==(const char* other) const {
|
bool operator==(const char* other) const {
|
||||||
return std::memcmp(fcc, other, sizeof(fcc)) == 0;
|
return std::memcmp(fcc, other, sizeof(fcc)) == 0;
|
||||||
}
|
}
|
||||||
bool operator!=(const char* other) const { return !operator==(other); }
|
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 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 num != other; }
|
bool operator!=(uint32_t other) const { return !operator==(other); }
|
||||||
|
|
||||||
std::string toString() const { return std::string(fcc, 4); }
|
std::string toString() const { return std::string(fcc, 4); }
|
||||||
uint32_t toUint32() const { return num; }
|
uint32_t toUint32() const { return num; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user