From f2e6c61bfa514a8a65d4c837ec5fa87a3a6d36c4 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Wed, 28 Sep 2022 20:26:09 +1000 Subject: [PATCH] GS: Use memcmp for GSVector2 comparisons Single compare-and-branch versus two. --- pcsx2/GS/GSVector.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pcsx2/GS/GSVector.h b/pcsx2/GS/GSVector.h index 098e1f0601..5e119bc038 100644 --- a/pcsx2/GS/GSVector.h +++ b/pcsx2/GS/GSVector.h @@ -15,6 +15,7 @@ #include "PrecompiledHeader.h" #include "GSIntrin.h" +#include #pragma once @@ -65,12 +66,12 @@ public: constexpr bool operator==(const GSVector2T& v) const { - return x == v.x && y == v.y; + return (std::memcmp(this, &v, sizeof(*this)) == 0); } constexpr bool operator!=(const GSVector2T& v) const { - return x != v.x || y != v.y; + return (std::memcmp(this, &v, sizeof(*this)) != 0); } constexpr GSVector2T operator*(const GSVector2T& v) const