From 3a27d4b480214072d972ac67561f2ee4010f8baa Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Tue, 24 Jul 2012 15:45:44 +0200 Subject: [PATCH] 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 Reviewed-by: Oswald Buddenhagen --- qmake/cachekeys.h | 4 ++-- qmake/generators/makefile.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/qmake/cachekeys.h b/qmake/cachekeys.h index c164304f314..da3aee1b359 100644 --- a/qmake/cachekeys.h +++ b/qmake/cachekeys.h @@ -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) { diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index af5a3eb321f..3a9bfc17e13 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -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; } };