diff --git a/src/libs/3rdparty/cplusplus/Literals.cpp b/src/libs/3rdparty/cplusplus/Literals.cpp
index 16eab541d7b120a2ccaaf0141c8ca13bfa282650..d0aa05d351264dbcbdc0a6d30279745f4b12082b 100644
--- a/src/libs/3rdparty/cplusplus/Literals.cpp
+++ b/src/libs/3rdparty/cplusplus/Literals.cpp
@@ -75,9 +75,21 @@ unsigned Literal::hashCode() const
 
 unsigned Literal::hashCode(const char *chars, unsigned size)
 {
-    unsigned h = 0;
-    for (unsigned i = 0; i < size; ++i)
-        h = (h >> 5) - h + chars[i];
+    /* Hash taken from QtCore's qHash for strings, which in turn has the note:
+
+    These functions are based on Peter J. Weinberger's hash function
+    (from the Dragon Book). The constant 24 in the original function
+    was replaced with 23 to produce fewer collisions on input such as
+    "a", "aa", "aaa", "aaaa", ...
+    */
+
+    uint h = 0;
+
+    while (size--) {
+        h = (h << 4) + *chars++;
+        h ^= (h & 0xf0000000) >> 23;
+        h &= 0x0fffffff;
+    }
     return h;
 }