Fix QT_SUPPORTS_INT128 checks

The macro is defined or not, not defined to 1 or 0.

Amends 1d7950c9467ba4db75ac065bd54ffe08e4a29710 (qhashfunctions.h),
0d85d0a72fd0136bd89e201d0cc1bf7fac2c24c8 (tst_qfloat16.cpp),
104a0a9ecdb18d65e4d9075d87e8860c6c9d8335 (tst_qglobal.cpp),
7a829eaf51853e0852db28b8b8223e1a62a3db0c (tst_qtendian.cpp).

Pick-to: 6.7
Change-Id: I190e208f3c96f27100dae3eef512739afa8fadd9
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit c78994a887f56f1bc77a5fa0db3b98196851db5e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2024-08-06 09:20:27 +02:00 committed by Qt Cherry-pick Bot
parent a3e4a7eecb
commit c250c59f7c
6 changed files with 8 additions and 8 deletions

View File

@ -139,7 +139,7 @@ Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(qint64 key, size_t seed = 0)
}
return qHash(quint64(key), seed);
}
#if QT_SUPPORTS_INT128
#ifdef QT_SUPPORTS_INT128
constexpr size_t qHash(quint128 key, size_t seed = 0) noexcept
{
return qHash(quint64(key + (key >> 64)), seed);

View File

@ -214,7 +214,7 @@ void tst_qfloat16::ordering()
CHECK_INT(qint16);
CHECK_INT(qint32);
CHECK_INT(qint64);
#if QT_SUPPORTS_INT128
#ifdef QT_SUPPORTS_INT128
CHECK_INT(qint128);
#endif
if (right >= 0) {
@ -224,7 +224,7 @@ void tst_qfloat16::ordering()
CHECK_INT(quint16);
CHECK_INT(quint32);
CHECK_INT(quint64);
#if QT_SUPPORTS_INT128
#ifdef QT_SUPPORTS_INT128
CHECK_INT(quint128);
#endif
}

View File

@ -59,7 +59,7 @@ void tst_GlobalTypes()
#endif /* QT_SUPPORTS_INT128 */
}
#if QT_SUPPORTS_INT128
#ifdef QT_SUPPORTS_INT128
qint128 tst_qint128_min() { return Q_INT128_MIN + 0; }
qint128 tst_qint128_max() { return 0 + Q_INT128_MAX; }
quint128 tst_quint128_max() { return Q_UINT128_MAX - 1 + 1; }

View File

@ -103,7 +103,7 @@ extern "C" { // functions in qglobal.c
void tst_GlobalTypes();
int tst_QtVersion();
const char *tst_qVersion();
#if QT_SUPPORTS_INT128
#ifdef QT_SUPPORTS_INT128
qint128 tst_qint128_min();
qint128 tst_qint128_max();
quint128 tst_quint128_max();

View File

@ -7,7 +7,7 @@
#include <QtCore/private/qendian_p.h>
#include <QtCore/qsysinfo.h>
#if QT_SUPPORTS_INT128
#ifdef QT_SUPPORTS_INT128
#define ONLY_INT128(...) __VA_ARGS__
#else
#define ONLY_INT128(...)

View File

@ -169,7 +169,7 @@ static void unsignedIntegerConsistency(quint64 value, size_t seed)
if (v32 == value)
QCOMPARE(hu64, hu32);
#if QT_SUPPORTS_INT128
#ifdef QT_SUPPORTS_INT128
const auto hu128 = qHash(quint128(value), seed);
QCOMPARE(hu128, hu64);
#endif
@ -216,7 +216,7 @@ void tst_QHashFunctions::signedIntegerConsistency()
QCOMPARE(hs64, hs32);
}
#if QT_SUPPORTS_INT128
#ifdef QT_SUPPORTS_INT128
const auto hs128 = qHash(qint128(value), seed);
QCOMPARE(hs128, hs64);
#endif