From 7bf9beb300db40835464c5b82da83cd8d49573c9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 18 Mar 2025 10:53:02 -0700 Subject: [PATCH] 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 --- src/gui/rhi/qrhid3d11_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/rhi/qrhid3d11_p.h b/src/gui/rhi/qrhid3d11_p.h index 703a3cc4499..11927a5a3bb 100644 --- a/src/gui/rhi/qrhid3d11_p.h +++ b/src/gui/rhi/qrhid3d11_p.h @@ -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