VertexLoaderUid: remove operator<

Not needed for unordered map.
This commit is contained in:
degasus 2014-12-11 22:47:56 +01:00
parent ec28a80e00
commit 1281798992
3 changed files with 12 additions and 34 deletions

View file

@ -28,7 +28,7 @@ class SWVertexLoader
bool m_TexGenSpecialCase; bool m_TexGenSpecialCase;
std::map<VertexLoaderUID, std::unique_ptr<VertexLoader>> m_VertexLoaderMap; std::unordered_map<VertexLoaderUID, std::unique_ptr<VertexLoader>> m_VertexLoaderMap;
std::vector<u8> m_LoadedVertices; std::vector<u8> m_LoadedVertices;
VertexLoader* m_CurrentLoader; VertexLoader* m_CurrentLoader;

View file

@ -57,25 +57,6 @@ public:
hash = CalculateHash(); hash = CalculateHash();
} }
bool operator < (const VertexLoaderUID &other) const
{
// This is complex because of speed.
if (vid[0] < other.vid[0])
return true;
else if (vid[0] > other.vid[0])
return false;
for (int i = 1; i < 5; ++i)
{
if (vid[i] < other.vid[i])
return true;
else if (vid[i] > other.vid[i])
return false;
}
return false;
}
bool operator == (const VertexLoaderUID& rh) const bool operator == (const VertexLoaderUID& rh) const
{ {
return hash == rh.hash && std::equal(vid, vid + sizeof(vid) / sizeof(vid[0]), rh.vid); return hash == rh.hash && std::equal(vid, vid + sizeof(vid) / sizeof(vid[0]), rh.vid);
@ -101,6 +82,17 @@ private:
} }
}; };
namespace std
{
template <> struct hash<VertexLoaderUID>
{
size_t operator()(const VertexLoaderUID& uid) const
{
return uid.GetHash();
}
};
}
// ARMTODO: This should be done in a better way // ARMTODO: This should be done in a better way
#ifndef _M_GENERIC #ifndef _M_GENERIC
class VertexLoader : public Gen::X64CodeBlock class VertexLoader : public Gen::X64CodeBlock

View file

@ -23,20 +23,6 @@
static NativeVertexFormat* s_current_vtx_fmt; static NativeVertexFormat* s_current_vtx_fmt;
namespace std
{
template <>
struct hash<VertexLoaderUID>
{
size_t operator()(const VertexLoaderUID& uid) const
{
return uid.GetHash();
}
};
}
typedef std::unordered_map<VertexLoaderUID, std::unique_ptr<VertexLoader>> VertexLoaderMap; typedef std::unordered_map<VertexLoaderUID, std::unique_ptr<VertexLoader>> VertexLoaderMap;
namespace VertexLoaderManager namespace VertexLoaderManager