Nix unused locals in matrix operations.

Compilers are presumably smart enough to throw away the bulk of that
automagically, but some were storing the return value of a method call
of some object that implemented an interface whic his a lot harder for
it to realize won't have side effects.
This commit is contained in:
David Hoover
2012-05-10 22:08:35 -07:00
parent 6d920c1211
commit e8c11aba87
4 changed files with 30 additions and 34 deletions
+15 -15
View File
@@ -448,12 +448,12 @@ public class Matrix3 implements IMatrix3, Serializable
@Override // from IMatrix3
public Matrix3 multAffine (IMatrix3 other, Matrix3 result) {
double m00 = this.m00, m01 = this.m01, m02 = this.m02;
double m10 = this.m10, m11 = this.m11, m12 = this.m12;
double m20 = this.m20, m21 = this.m21, m22 = this.m22;
double om00 = other.m00(), om01 = other.m01(), om02 = other.m02();
double om10 = other.m10(), om11 = other.m11(), om12 = other.m12();
double om20 = other.m20(), om21 = other.m21(), om22 = other.m22();
double m00 = this.m00, m01 = this.m01;
double m10 = this.m10, m11 = this.m11;
double m20 = this.m20, m21 = this.m21;
double om00 = other.m00(), om01 = other.m01();
double om10 = other.m10(), om11 = other.m11();
double om20 = other.m20(), om21 = other.m21();
return result.set(m00*om00 + m10*om01,
m00*om10 + m10*om11,
m00*om20 + m10*om21 + m20,
@@ -512,9 +512,9 @@ public class Matrix3 implements IMatrix3, Serializable
@Override // from IMatrix3
public Matrix3 invertAffine (Matrix3 result) throws SingularMatrixException {
double m00 = this.m00, m01 = this.m01, m02 = this.m02;
double m10 = this.m10, m11 = this.m11, m12 = this.m12;
double m20 = this.m20, m21 = this.m21, m22 = this.m22;
double m00 = this.m00, m01 = this.m01;
double m10 = this.m10, m11 = this.m11;
double m20 = this.m20, m21 = this.m21;
// compute the determinant, storing the subdeterminants for later use
double det = m00*m11 - m10*m01;
if (Math.abs(det) == 0f) {
@@ -566,12 +566,12 @@ public class Matrix3 implements IMatrix3, Serializable
@Override // from IMatrix3
public Matrix3 lerpAffine (IMatrix3 other, double t, Matrix3 result) {
double m00 = this.m00, m01 = this.m01, m02 = this.m02;
double m10 = this.m10, m11 = this.m11, m12 = this.m12;
double m20 = this.m20, m21 = this.m21, m22 = this.m22;
double om00 = other.m00(), om01 = other.m01(), om02 = other.m02();
double om10 = other.m10(), om11 = other.m11(), om12 = other.m12();
double om20 = other.m20(), om21 = other.m21(), om22 = other.m22();
double m00 = this.m00, m01 = this.m01;
double m10 = this.m10, m11 = this.m11;
double m20 = this.m20, m21 = this.m21;
double om00 = other.m00(), om01 = other.m01();
double om10 = other.m10(), om11 = other.m11();
double om20 = other.m20(), om21 = other.m21();
return result.set(m00 + t*(om00 - m00),
m10 + t*(om10 - m10),
m20 + t*(om20 - m20),
-2
View File
@@ -754,7 +754,6 @@ public final class Matrix4 implements IMatrix4, Serializable
double m00 = this.m00, m10 = this.m10, m20 = this.m20, m30 = this.m30;
double m01 = this.m01, m11 = this.m11, m21 = this.m21, m31 = this.m31;
double m02 = this.m02, m12 = this.m12, m22 = this.m22, m32 = this.m32;
double m03 = this.m03, m13 = this.m13, m23 = this.m23, m33 = this.m33;
// compute the determinant, storing the subdeterminants for later use
double sd00 = m11*m22 - m21*m12;
double sd10 = m01*m22 - m21*m02;
@@ -826,7 +825,6 @@ public final class Matrix4 implements IMatrix4, Serializable
double m00 = this.m00, m10 = this.m10, m20 = this.m20, m30 = this.m30;
double m01 = this.m01, m11 = this.m11, m21 = this.m21, m31 = this.m31;
double m02 = this.m02, m12 = this.m12, m22 = this.m22, m32 = this.m32;
double m03 = this.m03, m13 = this.m13, m23 = this.m23, m33 = this.m33;
return result.set(m00 + t*(other.m00() - m00),
m10 + t*(other.m10() - m10),
m20 + t*(other.m20() - m20),
+15 -15
View File
@@ -448,12 +448,12 @@ public class Matrix3 implements IMatrix3, Serializable
@Override // from IMatrix3
public Matrix3 multAffine (IMatrix3 other, Matrix3 result) {
float m00 = this.m00, m01 = this.m01, m02 = this.m02;
float m10 = this.m10, m11 = this.m11, m12 = this.m12;
float m20 = this.m20, m21 = this.m21, m22 = this.m22;
float om00 = other.m00(), om01 = other.m01(), om02 = other.m02();
float om10 = other.m10(), om11 = other.m11(), om12 = other.m12();
float om20 = other.m20(), om21 = other.m21(), om22 = other.m22();
float m00 = this.m00, m01 = this.m01;
float m10 = this.m10, m11 = this.m11;
float m20 = this.m20, m21 = this.m21;
float om00 = other.m00(), om01 = other.m01();
float om10 = other.m10(), om11 = other.m11();
float om20 = other.m20(), om21 = other.m21();
return result.set(m00*om00 + m10*om01,
m00*om10 + m10*om11,
m00*om20 + m10*om21 + m20,
@@ -512,9 +512,9 @@ public class Matrix3 implements IMatrix3, Serializable
@Override // from IMatrix3
public Matrix3 invertAffine (Matrix3 result) throws SingularMatrixException {
float m00 = this.m00, m01 = this.m01, m02 = this.m02;
float m10 = this.m10, m11 = this.m11, m12 = this.m12;
float m20 = this.m20, m21 = this.m21, m22 = this.m22;
float m00 = this.m00, m01 = this.m01;
float m10 = this.m10, m11 = this.m11;
float m20 = this.m20, m21 = this.m21;
// compute the determinant, storing the subdeterminants for later use
float det = m00*m11 - m10*m01;
if (Math.abs(det) == 0f) {
@@ -566,12 +566,12 @@ public class Matrix3 implements IMatrix3, Serializable
@Override // from IMatrix3
public Matrix3 lerpAffine (IMatrix3 other, float t, Matrix3 result) {
float m00 = this.m00, m01 = this.m01, m02 = this.m02;
float m10 = this.m10, m11 = this.m11, m12 = this.m12;
float m20 = this.m20, m21 = this.m21, m22 = this.m22;
float om00 = other.m00(), om01 = other.m01(), om02 = other.m02();
float om10 = other.m10(), om11 = other.m11(), om12 = other.m12();
float om20 = other.m20(), om21 = other.m21(), om22 = other.m22();
float m00 = this.m00, m01 = this.m01;
float m10 = this.m10, m11 = this.m11;
float m20 = this.m20, m21 = this.m21;
float om00 = other.m00(), om01 = other.m01();
float om10 = other.m10(), om11 = other.m11();
float om20 = other.m20(), om21 = other.m21();
return result.set(m00 + t*(om00 - m00),
m10 + t*(om10 - m10),
m20 + t*(om20 - m20),
-2
View File
@@ -754,7 +754,6 @@ public final class Matrix4 implements IMatrix4, Serializable
float m00 = this.m00, m10 = this.m10, m20 = this.m20, m30 = this.m30;
float m01 = this.m01, m11 = this.m11, m21 = this.m21, m31 = this.m31;
float m02 = this.m02, m12 = this.m12, m22 = this.m22, m32 = this.m32;
float m03 = this.m03, m13 = this.m13, m23 = this.m23, m33 = this.m33;
// compute the determinant, storing the subdeterminants for later use
float sd00 = m11*m22 - m21*m12;
float sd10 = m01*m22 - m21*m02;
@@ -826,7 +825,6 @@ public final class Matrix4 implements IMatrix4, Serializable
float m00 = this.m00, m10 = this.m10, m20 = this.m20, m30 = this.m30;
float m01 = this.m01, m11 = this.m11, m21 = this.m21, m31 = this.m31;
float m02 = this.m02, m12 = this.m12, m22 = this.m22, m32 = this.m32;
float m03 = this.m03, m13 = this.m13, m23 = this.m23, m33 = this.m33;
return result.set(m00 + t*(other.m00() - m00),
m10 + t*(other.m10() - m10),
m20 + t*(other.m20() - m20),