mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-17 04:51:52 +00:00
Fixup some more hashes
This commit is contained in:
parent
0a2d358e31
commit
63df17a63c
3 changed files with 20 additions and 4 deletions
|
@ -580,7 +580,11 @@ struct CEntityIdHashMapTraits
|
|||
size_t operator() (const NLMISC::CEntityId &id ) const
|
||||
{
|
||||
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());
|
||||
}
|
||||
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
|
||||
{
|
||||
return id1.size() < id2.size();
|
||||
return id1 < id2;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -71,6 +71,19 @@ struct CContextMatcher
|
|||
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
|
||||
{
|
||||
return size_t(HashValue);
|
||||
|
@ -89,10 +102,9 @@ struct CContextMatcher
|
|||
}
|
||||
bool operator() (const CContextMatcher &patternMatcher1, const CContextMatcher &patternMatcher2) const
|
||||
{
|
||||
return patternMatcher1.getHashValue() < patternMatcher2.getHashValue();
|
||||
return patternMatcher1 < patternMatcher2;
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue