QHashFunctions: port to if constexpr

Condition is a compile-time one.

Change-Id: I6e60f12cc51e96b2528c375017357c0631e2fc0b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Giuseppe D'Angelo 2020-03-12 12:31:07 +01:00
parent 317383217b
commit 2c9a29a09a

View File

@ -115,7 +115,7 @@ Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(long key, size_t seed
{ return QHashPrivate::hash(size_t(key), seed); }
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline size_t qHash(quint64 key, size_t seed = 0) noexcept
{
if (sizeof(quint64) > sizeof(size_t))
if constexpr (sizeof(quint64) > sizeof(size_t))
key ^= (key >> 32);
return QHashPrivate::hash(size_t(key), seed);
}