QPalette: optimize move assignment operator
Instead of assigning the various bit-fields manually, use the quint32 union field, which is already present to avoid slow bit-field operations in the member-swap function. Verifed that the generated assembly for move-assignment is significantly better than before on GCC. Change-Id: If4e0ef678bf3a496c6eb369ad3f639f5a9bc79fc Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
24040ca43c
commit
4051914641
@ -72,8 +72,7 @@ public:
|
|||||||
#ifdef Q_COMPILER_RVALUE_REFS
|
#ifdef Q_COMPILER_RVALUE_REFS
|
||||||
inline QPalette &operator=(QPalette &&other)
|
inline QPalette &operator=(QPalette &&other)
|
||||||
{
|
{
|
||||||
data.resolve_mask = other.data.resolve_mask;
|
for_faster_swapping_dont_use = other.for_faster_swapping_dont_use;
|
||||||
data.current_group = other.data.current_group;
|
|
||||||
qSwap(d, other.d); return *this;
|
qSwap(d, other.d); return *this;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user