Skip to content

Commit

Permalink
qHash: provide the long double overload on Darwin systems
Browse files Browse the repository at this point in the history
Commit c0791ac didn't explain why it
was #ifdef'ed out. It's just an alias for double. Maybe compilers at the
time used to complain if you used it, but I can't make Apple's clang
produce a warning now.

Pick-to: 6.7
Change-Id: I664b9f014ffc48cbb49bfffd17b02293403e9571
Reviewed-by: Qt CI Bot <[email protected]>
Reviewed-by: Giuseppe D'Angelo <[email protected]>
  • Loading branch information
thiagomacieira committed Feb 3, 2024
1 parent a327117 commit c5f22c5
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 6 deletions.
2 changes: 0 additions & 2 deletions src/corelib/tools/qhash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,6 @@ size_t qHash(double key, size_t seed) noexcept
}
}

#if !defined(Q_OS_DARWIN) || defined(Q_QDOC)
/*! \relates QHash
\since 5.3
Expand All @@ -1456,7 +1455,6 @@ size_t qHash(long double key, size_t seed) noexcept
return murmurhash(&key, sizeof(key), seed);
}
}
#endif

/*! \fn size_t qHash(const QChar key, size_t seed = 0)
\relates QHash
Expand Down
2 changes: 0 additions & 2 deletions src/corelib/tools/qhashfunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ Q_DECL_CONST_FUNCTION inline size_t qHash(float key, size_t seed = 0) noexcept
return QHashPrivate::hash(k, seed);
}
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION size_t qHash(double key, size_t seed = 0) noexcept;
#if !defined(Q_OS_DARWIN) || defined(Q_QDOC)
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION size_t qHash(long double key, size_t seed = 0) noexcept;
#endif
Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(wchar_t key, size_t seed = 0) noexcept
{ return QHashPrivate::hash(size_t(key), seed); }
Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(char16_t key, size_t seed = 0) noexcept
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,7 @@ void tst_QHashFunctions::qhash_of_zero_floating_points()
{
QCOMPARE(qHash(-0.0f, seed), qHash(0.0f, seed));
QCOMPARE(qHash(-0.0 , seed), qHash(0.0 , seed));
#ifndef Q_OS_DARWIN
QCOMPARE(qHash(-0.0L, seed), qHash(0.0L, seed));
#endif
}

void tst_QHashFunctions::qthash_data()
Expand Down

0 comments on commit c5f22c5

Please sign in to comment.