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:
Marc Mutz 2014-02-26 22:33:29 +01:00 committed by The Qt Project
parent 24040ca43c
commit 4051914641

View File

@ -72,8 +72,7 @@ public:
#ifdef Q_COMPILER_RVALUE_REFS
inline QPalette &operator=(QPalette &&other)
{
data.resolve_mask = other.data.resolve_mask;
data.current_group = other.data.current_group;
for_faster_swapping_dont_use = other.for_faster_swapping_dont_use;
qSwap(d, other.d); return *this;
}
#endif