aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2024-05-23 12:01:50 +0200
committerUlf Hermann <ulf.hermann@qt.io>2024-05-28 15:22:14 +0200
commitd2e355d10179890e41df1fe50e3f2322ff08c038 (patch)
tree687b6cc87827da7323999c37cf88d1360309c6e7 /src
parent0e9958d9eff3c3166b396ce6dc555abb0d0db8db (diff)
V4: Store the sign bit of NaNs in QV4::StaticValue
We have a bit for this, which is already used on UMinus. We should also use it when directly encoding a double. This makes some ECMAScript tests pass. Pick-to: 6.7 6.5 Change-Id: Ie90c7ae9ce57064d14db0ed719a08d5858b47cd4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/qml/common/qv4staticvalue_p.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/common/qv4staticvalue_p.h b/src/qml/common/qv4staticvalue_p.h
index e887cdc674..9b4f582c00 100644
--- a/src/qml/common/qv4staticvalue_p.h
+++ b/src/qml/common/qv4staticvalue_p.h
@@ -366,10 +366,10 @@ struct StaticValue
QV4_NEARLY_ALWAYS_INLINE void setDouble(double d) {
if (qt_is_nan(d)) {
// We cannot store just any NaN. It has to be a NaN with only the quiet bit
- // set in the upper bits of the mantissa and the sign bit off.
+ // set in the upper bits of the mantissa and the sign bit either on or off.
// qt_qnan() happens to produce such a thing via std::numeric_limits,
// but this is actually not guaranteed. Therefore, we make our own.
- _val = (quint64(QuickType::NaN) << Tag_Shift);
+ _val = (quint64(std::signbit(d) ? QuickType::MinusNaN : QuickType::NaN) << Tag_Shift);
Q_ASSERT(isNaN());
} else {
memcpy(&_val, &d, 8);