summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-05-04 13:43:02 +0200
committerKonstantin Ritt <ritt.ks@gmail.com>2015-05-13 01:08:55 +0000
commitce9ad30c78fe0c9ada7cde579f4f9945821f8e5f (patch)
tree849e40160786758dc40b70236b0ad113ff14a2ce /src/gui
parent894a81a1fbb12fbde923015a517a7fcdcae923b5 (diff)
QQuaternion: optimize op*
Swap subexpressions around so the expressions involving w (the first member in memory order) execute first. And no, compilers don't do that automatically. Well, GCC 4.9 doesn't. Change-Id: I918ecc27a9ac9775fa91968c0548d182d7ad28e3 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/math3d/qquaternion.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h
index 1fbd8b826c..5b0006ac56 100644
--- a/src/gui/math3d/qquaternion.h
+++ b/src/gui/math3d/qquaternion.h
@@ -240,9 +240,9 @@ inline QQuaternion &QQuaternion::operator*=(float factor)
inline const QQuaternion operator*(const QQuaternion &q1, const QQuaternion& q2)
{
- float ww = (q1.zp + q1.xp) * (q2.xp + q2.yp);
float yy = (q1.wp - q1.yp) * (q2.wp + q2.zp);
float zz = (q1.wp + q1.yp) * (q2.wp - q2.zp);
+ float ww = (q1.zp + q1.xp) * (q2.xp + q2.yp);
float xx = ww + yy + zz;
float qq = 0.5 * (xx + (q1.zp - q1.xp) * (q2.xp - q2.yp));