QRhiD3D11: fix qHash() to use qHashMulti()

The old code used XOR to combine hash values, but XOR is a bad combiner,
since it's mixing the bits insufficiently (XORing the same value again
will e.g. undo the original change).

This is a private class, so there are no users outside of Qt that would
have inlined this qHash() function; therefore, we are free to change the
algorithm.

Pick-to: 6.9
Change-Id: I7970e52ef4bd3b6a2248fffda0d4d75eb4afdf5a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Thiago Macieira 2025-03-18 10:53:02 -07:00 committed by Marc Mutz
parent de90f2e064
commit 7bf9beb300

View File

@ -875,7 +875,7 @@ inline bool operator!=(const QRhiD3D11::BytecodeCacheKey &a, const QRhiD3D11::By
inline size_t qHash(const QRhiD3D11::BytecodeCacheKey &k, size_t seed = 0) noexcept
{
return qHash(k.sourceHash, seed) ^ qHash(k.target) ^ qHash(k.entryPoint) ^ k.compileFlags;
return qHashMulti(seed, k.sourceHash, k.target, k.entryPoint, k.compileFlags);
}
QT_END_NAMESPACE