Compute SHAMapNode hashes faster.

This commit is contained in:
JoelKatz
2013-03-06 01:10:23 -08:00
parent 7f29336d0b
commit a8daf34a08

View File

@@ -23,16 +23,11 @@ DECLARE_INSTANCE(SHAMapTreeNode);
void SHAMapNode::setHash() const
{
#if 0
std::size_t h = theApp->getNonceST() + (mDepth * 0x9e3779b9);
mHash = mNodeID.hash_combine(h);
#else
std::size_t h = theApp->getNonceST() + (mDepth * 0x9e3779b9);
const unsigned int *ptr = reinterpret_cast<const unsigned int *>(mNodeID.begin());
for (int i = (mDepth + 3) / 4; i != 0; --i)
boost::hash_combine(h, *ptr++);
for (int i = (mDepth + 7) / 8; i != 0; --i)
h = (h * 0x9e3779b9) ^ *ptr++;
mHash = h;
#endif
}
std::size_t hash_value(const SHAMapNode& mn)