diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-09-12 13:15:20 +0200 |
---|---|---|
committer | Dmitry Shachnev <mitya57@gmail.com> | 2016-10-10 11:20:46 +0000 |
commit | a191de3f4dd777e8e60b4d3b5684b59d22be068d (patch) | |
tree | 18421ce804e4dd73d75c0e110a26264b8ff2c15e /src/qml/jsruntime/qv4value_p.h | |
parent | 4b14c4b4da2294926d649ea767cc22b14bc3061e (diff) |
Fix V4 on big-endian
We can't both invert offset position and inter-value positions of tag
and value.
This patch changes 32-bit big-endian to use the same order inside
the tag/value but just at different offsets. This also make it
compatible with how we use it with doubles.
This fixes value/tag reads on 32-bit big-endian and offsets on 64-bit.
Task-number: QTBUG-56271
Change-Id: I95cf792c29ac3f42a4018ce1f115193c143a0df0
(cherry picked from commit 2a658344397729450f869138bf77e063a0a6166b)
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4value_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4value_p.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h index 02425c52a5..ebe43b505d 100644 --- a/src/qml/jsruntime/qv4value_p.h +++ b/src/qml/jsruntime/qv4value_p.h @@ -158,19 +158,16 @@ public: Q_ALWAYS_INLINE quint64 rawValue() const { return _val; } Q_ALWAYS_INLINE void setRawValue(quint64 raw) { _val = raw; } -#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN || defined(QV4_USE_64_BIT_VALUE_ENCODING) +#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN static inline int valueOffset() { return 0; } static inline int tagOffset() { return 4; } - Q_ALWAYS_INLINE void setTagValue(quint32 tag, quint32 value) { _val = quint64(tag) << 32 | value; } - Q_ALWAYS_INLINE quint32 value() const { return _val & quint64(~quint32(0)); } - Q_ALWAYS_INLINE quint32 tag() const { return _val >> 32; } -#else // !Q_LITTLE_ENDIAN && !defined(QV4_USE_64_BIT_VALUE_ENCODING) +#else // !Q_LITTLE_ENDIAN static inline int valueOffset() { return 4; } static inline int tagOffset() { return 0; } - Q_ALWAYS_INLINE void setTagValue(quint32 tag, quint32 value) { _val = quint64(value) << 32 | tag; } - Q_ALWAYS_INLINE quint32 tag() const { return _val & quint64(~quint32(0)); } - Q_ALWAYS_INLINE quint32 value() const { return _val >> 32; } #endif + Q_ALWAYS_INLINE void setTagValue(quint32 tag, quint32 value) { _val = quint64(tag) << 32 | value; } + Q_ALWAYS_INLINE quint32 value() const { return _val & quint64(~quint32(0)); } + Q_ALWAYS_INLINE quint32 tag() const { return _val >> 32; } #if defined(V4_BOOTSTRAP) Q_ALWAYS_INLINE Heap::Base *m() const { Q_UNREACHABLE(); return Q_NULLPTR; } |