From 764c402a696d2bb8d72e1c716b7aab062b142a64 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Sat, 2 Dec 2017 17:36:20 -0500 Subject: [PATCH] GraphicsDefs: Revert back to casting structs to integers to compare them. This reverts commit d3abf525c5f0ba0260a11649eb439a4e4730d39d. Clang's warning was a little overzealous; this is not a problem on x86. --- headers/os/interface/GraphicsDefs.h | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/headers/os/interface/GraphicsDefs.h b/headers/os/interface/GraphicsDefs.h index 124436b1d2..e98d6deba0 100644 --- a/headers/os/interface/GraphicsDefs.h +++ b/headers/os/interface/GraphicsDefs.h @@ -19,11 +19,9 @@ typedef struct pattern { inline bool operator==(const pattern& a, const pattern& b) { - for (int i = 0; i < 8; i++) { - if (a.data[i] != b.data[i]) - return false; - } - return true; + uint64* pa = (uint64*)a.data; + uint64* pb = (uint64*)b.data; + return (*pa == *pb); } @@ -64,16 +62,13 @@ typedef struct rgb_color { inline bool operator==(const rgb_color& other) const { - return red == other.red - && green == other.green - && blue == other.blue - && alpha == other.alpha; + return *(const uint32 *)this == *(const uint32 *)&other; } inline bool operator!=(const rgb_color& other) const { - return !(*this == other); + return *(const uint32 *)this != *(const uint32 *)&other; } inline rgb_color&