GraphicsDefs: Do not cast structs to integers to compare them.
That requires more padding (1 byte vs 4 or 8 depending on integer size), so just use regular loops and chained ==s. Caught by Clang. No functional change intended.
This commit is contained in:
@@ -19,9 +19,11 @@ typedef struct pattern {
|
||||
inline bool
|
||||
operator==(const pattern& a, const pattern& b)
|
||||
{
|
||||
uint64* pa = (uint64*)a.data;
|
||||
uint64* pb = (uint64*)b.data;
|
||||
return (*pa == *pb);
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (a.data[i] != b.data[i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,13 +64,16 @@ typedef struct rgb_color {
|
||||
inline bool
|
||||
operator==(const rgb_color& other) const
|
||||
{
|
||||
return *(const uint32 *)this == *(const uint32 *)&other;
|
||||
return red == other.red
|
||||
&& green == other.green
|
||||
&& blue == other.blue
|
||||
&& alpha == other.alpha;
|
||||
}
|
||||
|
||||
inline bool
|
||||
operator!=(const rgb_color& other) const
|
||||
{
|
||||
return *(const uint32 *)this != *(const uint32 *)&other;
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
inline rgb_color&
|
||||
|
||||
Reference in New Issue
Block a user