Fixup some more hashes
--HG-- branch : develop
This commit is contained in:
parent
1a5a0d5acb
commit
ec30735198
3 changed files with 20 additions and 4 deletions
|
@ -580,7 +580,11 @@ struct CEntityIdHashMapTraits
|
||||||
size_t operator() (const NLMISC::CEntityId &id ) const
|
size_t operator() (const NLMISC::CEntityId &id ) const
|
||||||
{
|
{
|
||||||
uint64 hash64 = id.getUniqueId();
|
uint64 hash64 = id.getUniqueId();
|
||||||
return size_t(hash64) ^ size_t( hash64 >> 32 );
|
#if (HAVE_X86_64)
|
||||||
|
return (size_t)hash64;
|
||||||
|
#else
|
||||||
|
return (size_t)hash64 ^ (size_t)(hash64 >> 32);
|
||||||
|
#endif
|
||||||
//return size_t(id.getShortId());
|
//return size_t(id.getShortId());
|
||||||
}
|
}
|
||||||
bool operator() (const NLMISC::CEntityId &id1, const NLMISC::CEntityId &id2) const
|
bool operator() (const NLMISC::CEntityId &id1, const NLMISC::CEntityId &id2) const
|
||||||
|
|
|
@ -363,7 +363,7 @@ struct CUCStringHashMapTraits
|
||||||
}
|
}
|
||||||
bool operator() (const ucstring &id1, const ucstring &id2) const
|
bool operator() (const ucstring &id1, const ucstring &id2) const
|
||||||
{
|
{
|
||||||
return id1.size() < id2.size();
|
return id1 < id2;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,19 @@ struct CContextMatcher
|
||||||
return memcmp(JokersValues, other.JokersValues, sizeof(uint32)*NbJoker) == 0;
|
return memcmp(JokersValues, other.JokersValues, sizeof(uint32)*NbJoker) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool operator<(const CContextMatcher &other) const
|
||||||
|
{
|
||||||
|
if (UseRandom)
|
||||||
|
if (RandomValue != other.RandomValue)
|
||||||
|
return RandomValue < other.RandomValue;
|
||||||
|
|
||||||
|
int cmp = memcmp(JokersValues, other.JokersValues, sizeof(uint32) * NbJoker);
|
||||||
|
if (cmp != 0)
|
||||||
|
return cmp < 0;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
size_t getHashValue() const
|
size_t getHashValue() const
|
||||||
{
|
{
|
||||||
return size_t(HashValue);
|
return size_t(HashValue);
|
||||||
|
@ -89,10 +102,9 @@ struct CContextMatcher
|
||||||
}
|
}
|
||||||
bool operator() (const CContextMatcher &patternMatcher1, const CContextMatcher &patternMatcher2) const
|
bool operator() (const CContextMatcher &patternMatcher1, const CContextMatcher &patternMatcher2) const
|
||||||
{
|
{
|
||||||
return patternMatcher1.getHashValue() < patternMatcher2.getHashValue();
|
return patternMatcher1 < patternMatcher2;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue