VideoCommon: use memcmp to compare shader uid

This commit is contained in:
degasus 2013-09-11 17:34:23 +02:00
parent 3b0b5155e8
commit 3fcdf5e25b
1 changed files with 3 additions and 11 deletions

View File

@ -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<class T>