aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4value_p.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-09-12 13:15:20 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-09-12 17:31:39 +0000
commit2a658344397729450f869138bf77e063a0a6166b (patch)
treee79bec2462a17502b834c09bcd7958820ffdbf30 /src/qml/jsruntime/qv4value_p.h
parent92eccb348d8cdf2d6e3f9e05e8b2b43d134bc114 (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. Change-Id: I95cf792c29ac3f42a4018ce1f115193c143a0df0 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4value_p.h')
-rw-r--r--src/qml/jsruntime/qv4value_p.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h
index b2d64213f5..5ce1d16911 100644
--- a/src/qml/jsruntime/qv4value_p.h
+++ b/src/qml/jsruntime/qv4value_p.h
@@ -102,19 +102,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; }