diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-08-29 18:56:12 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-08-30 21:11:22 +0200 |
commit | d3ba159ed2c0a5b0a5bf3708700457fe451b6620 (patch) | |
tree | 3a5a0b93672608b6e514ac3f9887f9cb934eb626 /src/corelib/kernel/qvariant.h | |
parent | 8641d5d729370b14f817a9e33446c38ace710429 (diff) |
Fix alignment of QVariant::Private::data on 32bit systems
We want a suitable alignment to hold a double even on
32bit systems.
Change-Id: I35145ded9320c147d4fcd7a04c4b3630912cc00a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Nodir Temirkhodjaev <nodir.temir@gmail.com>
Diffstat (limited to 'src/corelib/kernel/qvariant.h')
-rw-r--r-- | src/corelib/kernel/qvariant.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index b2b72523a9..6080c25f0d 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -426,14 +426,15 @@ class Q_CORE_EXPORT QVariant { static constexpr size_t MaxInternalSize = 3*sizeof(void *); template<typename T> - static constexpr bool CanUseInternalSpace = (sizeof(T) <= MaxInternalSize && alignof(T) <= alignof(void *)); + static constexpr bool CanUseInternalSpace = (sizeof(T) <= MaxInternalSize && alignof(T) <= alignof(double)); static constexpr bool canUseInternalSpace(size_t s, size_t align) - { return s <= MaxInternalSize && align <= alignof(void *); } + { return s <= MaxInternalSize && align <= alignof(double); } union { uchar data[MaxInternalSize] = {}; PrivateShared *shared; + double _forAlignment; // we want an 8byte alignment on 32bit systems as well } data; quintptr is_shared : 1; quintptr is_null : 1; |