1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

Adjusted ImutAVLTree::ComputeHash to compute a hash value that is based on a

clearer sequence of hashing compositions.

llvm-svn: 46227
This commit is contained in:
Ted Kremenek 2008-01-21 22:50:37 +00:00
parent fed0381d40
commit 1c8968610e

View File

@ -210,11 +210,24 @@ private:
unsigned ComputeHash(ImutAVLTree* L, ImutAVLTree* R, value_type_ref V) {
FoldingSetNodeID ID;
ID.AddInteger(L ? L->ComputeHash() : 0);
if (L) ID.AddInteger(L->ComputeHash());
ImutInfo::Profile(ID,V);
ID.AddInteger(R ? R->ComputeHash() : 0);
return ID.ComputeHash();
// Compute the "intermediate" hash. Basically, we want the net profile to
// be: H(H(....H(H(H(item0),item1),item2)...),itemN), where
// H(item) is the hash of the data item and H(hash,item) is a hash
// of the last item hash and the the next item.
unsigned X = ID.ComputeHash();
ID.clear();
if (R) {
ID.AddInteger(X);
ID.AddInteger(R->ComputeHash());
X = ID.ComputeHash();
}
return X;
}
inline unsigned ComputeHash() {