Fix qmake hash function to use XOR

Use XOR instead of OR in order to avoid saturating all bits when computing the
hash value.

Change-Id: I50b1a044eb827239dae1c04732ca6a065f6233b4
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
Rafael Roquetto 2012-07-24 15:45:44 +02:00 committed by Qt by Nokia
parent 4677cf3d01
commit 3a27d4b480
2 changed files with 3 additions and 3 deletions

View File

@ -73,7 +73,7 @@ struct FixStringCacheKey
}
inline uint hashCode() const {
if(!hash)
hash = qHash(string) | qHash(flags) /*| qHash(pwd)*/;
hash = qHash(string) ^ qHash(flags) /*^ qHash(pwd)*/;
return hash;
}
};
@ -98,7 +98,7 @@ struct FileInfoCacheKey
}
inline uint hashCode() const {
if(!hash)
hash = qHash(file) /*| qHash(pwd)*/;
hash = qHash(file) /*^ qHash(pwd)*/;
return hash;
}
inline bool isRelativePath(const QString &file) {

View File

@ -68,7 +68,7 @@ struct ReplaceExtraCompilerCacheKey
bool operator==(const ReplaceExtraCompilerCacheKey &f) const;
inline uint hashCode() const {
if(!hash)
hash = qHash(var) | qHash(in) | qHash(out) /*| qHash(pwd)*/;
hash = qHash(var) ^ qHash(in) ^ qHash(out) /*^ qHash(pwd)*/;
return hash;
}
};