mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +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:
parent
fed0381d40
commit
1c8968610e
@ -210,11 +210,24 @@ private:
|
|||||||
unsigned ComputeHash(ImutAVLTree* L, ImutAVLTree* R, value_type_ref V) {
|
unsigned ComputeHash(ImutAVLTree* L, ImutAVLTree* R, value_type_ref V) {
|
||||||
FoldingSetNodeID ID;
|
FoldingSetNodeID ID;
|
||||||
|
|
||||||
ID.AddInteger(L ? L->ComputeHash() : 0);
|
if (L) ID.AddInteger(L->ComputeHash());
|
||||||
ImutInfo::Profile(ID,V);
|
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() {
|
inline unsigned ComputeHash() {
|
||||||
|
Loading…
Reference in New Issue
Block a user