diff options
author | Erik Verbruggen <[email protected]> | 2018-01-26 11:28:06 +0100 |
---|---|---|
committer | Erik Verbruggen <[email protected]> | 2018-02-05 09:15:25 +0000 |
commit | 8501993e5275076d9163a7e2f8bab9ba2f187f72 (patch) | |
tree | 3db7ebe28102dd1e952a6a511f5d70488adfbf4d /src/qml/jsruntime/qv4value_p.h | |
parent | c2bd33af9fb548ff20bf34323271baa89cbc8a55 (diff) |
QML: Collapse all NaNs into one single (encoded) NaN
The idea of NaN boxing is to use one single NaN as a "true" NaN, and all
others as a boxed value. So when encoding some NaN, be sure to use that
one "true" NaN. Otherwise, it will be interpreted as an encoded value.
Task-number: QTBUG-65998
Change-Id: Ia6e4641be180f3d626c40a57b473f181358e04db
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4value_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4value_p.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h index 9adad881a1..94233d4ddb 100644 --- a/src/qml/jsruntime/qv4value_p.h +++ b/src/qml/jsruntime/qv4value_p.h @@ -56,6 +56,8 @@ #include "qv4global_p.h" #include <private/qv4heap_p.h> +#include <private/qnumeric_p.h> + #if QT_POINTER_SIZE == 8 #define QV4_USE_64_BIT_VALUE_ENCODING #endif @@ -362,6 +364,8 @@ public: return d; } QML_NEARLY_ALWAYS_INLINE void setDouble(double d) { + if (qt_is_nan(d)) + d = qt_qnan(); memcpy(&_val, &d, 8); #ifdef QV4_USE_64_BIT_VALUE_ENCODING _val ^= NaNEncodeMask; |