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>bb10
parent
8641d5d729
commit
d3ba159ed2
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue