Replace all Application nonces with nonce singleton and refactor hash_value functions

This commit is contained in:
Vinnie Falco
2013-06-04 13:35:54 -07:00
parent 0523d6a054
commit b523b6c8d4
17 changed files with 69 additions and 76 deletions

View File

@@ -24,11 +24,15 @@ DECLARE_INSTANCE(SHAMapTreeNode);
void SHAMapNode::setMHash() const
{
std::size_t h = theApp->getNonceST() + (mDepth * 0x9e3779b9);
const unsigned int *ptr = reinterpret_cast<const unsigned int *>(mNodeID.begin());
for (int i = (mDepth + 7) / 8; i != 0; --i)
std::size_t h = HashMaps::getInstance ().getNonce <std::size_t> ()
+ (mDepth * 0x9e3779b9);
const unsigned int *ptr = reinterpret_cast <const unsigned int *>(mNodeID.begin());
for (int i = (mDepth + 7) / 8; i != 0; --i)
h = (h * 0x9e3779b9) ^ *ptr++;
mHash = h;
mHash = h;
}
std::size_t hash_value(const SHAMapNode& mn)