summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-02-20 13:27:05 +0100
committerGitHub <noreply@github.com>2019-02-20 13:27:05 +0100
commit75c89aaaef94a972fe257d5b6589862853847387 (patch)
treeb531c5449b448ddfeb0134b546bc150ca028becc
parent1f257d3f8cab6fb7ccdde71403016be133d692c2 (diff)
parentb6b113cc2b41797367ace0f91c29c0118b6c301a (diff)
Merge pull request #26069 from hpvb/align-variant
Align the Variant data member
-rw-r--r--core/variant.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/variant.h b/core/variant.h
index a819ba1f8c..9215d15bf0 100644
--- a/core/variant.h
+++ b/core/variant.h
@@ -69,6 +69,13 @@ typedef PoolVector<Vector2> PoolVector2Array;
typedef PoolVector<Vector3> PoolVector3Array;
typedef PoolVector<Color> PoolColorArray;
+// Temporary workaround until c++11 alignas()
+#ifdef __GNUC__
+#define GCC_ALIGNED_8 __attribute__((aligned(8)))
+#else
+#define GCC_ALIGNED_8
+#endif
+
class Variant {
public:
// If this changes the table in variant_op must be updated
@@ -132,7 +139,6 @@ private:
_FORCE_INLINE_ const ObjData &_get_obj() const;
union {
-
bool _bool;
int64_t _int;
double _real;
@@ -142,7 +148,7 @@ private:
Transform *_transform;
void *_ptr; //generic pointer
uint8_t _mem[sizeof(ObjData) > (sizeof(real_t) * 4) ? sizeof(ObjData) : (sizeof(real_t) * 4)];
- } _data;
+ } _data GCC_ALIGNED_8;
void reference(const Variant &p_variant);
void clear();