From 3fcdf5e25b9500f6bf9c46c8351d14569e8b3a85 Mon Sep 17 00:00:00 2001 From: degasus Date: Wed, 11 Sep 2013 17:34:23 +0200 Subject: [PATCH] VideoCommon: use memcmp to compare shader uid --- Source/Core/VideoCommon/Src/ShaderGenCommon.h | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/Source/Core/VideoCommon/Src/ShaderGenCommon.h b/Source/Core/VideoCommon/Src/ShaderGenCommon.h index d2c8ec3710..31ec8d3e71 100644 --- a/Source/Core/VideoCommon/Src/ShaderGenCommon.h +++ b/Source/Core/VideoCommon/Src/ShaderGenCommon.h @@ -88,26 +88,18 @@ public: bool operator == (const ShaderUid& obj) const { - return memcmp(this->values, obj.values, sizeof(values)) == 0; + return memcmp(this->values, obj.values, data.NumValues() * sizeof(*values)) == 0; } bool operator != (const ShaderUid& obj) const { - return memcmp(this->values, obj.values, sizeof(values)) != 0; + return memcmp(this->values, obj.values, data.NumValues() * sizeof(*values)) != 0; } // determines the storage order inside STL containers bool operator < (const ShaderUid& obj) const { - // TODO: Store last frame used and order by that? makes much more sense anyway... - for (unsigned int i = 0; i < data.NumValues(); ++i) - { - if (this->values[i] < obj.values[i]) - return true; - else if (this->values[i] > obj.values[i]) - return false; - } - return false; + return memcmp(this->values, obj.values, data.NumValues() * sizeof(*values)) < 0; } template