Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
VideoCommon: use memcmp to compare shader uid
  • Loading branch information
degasus committed Sep 11, 2013
1 parent 3b0b515 commit 3fcdf5e
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions Source/Core/VideoCommon/Src/ShaderGenCommon.h
Expand Up @@ -88,26 +88,18 @@ class ShaderUid : public ShaderGeneratorInterface

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>
Expand Down

0 comments on commit 3fcdf5e

Please sign in to comment.