JOML-CI / JOML

A Java math library for OpenGL rendering calculations
MIT License
728 stars 104 forks source link

unnecessary assigning to new variables #305

Closed ShiCheng-Lu closed 2 years ago

ShiCheng-Lu commented 2 years ago

https://github.com/JOML-CI/JOML/blob/f5ede558e10972029658e10164118460eeb0bf58/src/org/joml/Matrix4d.java#L4847

double nm00 = rm00;
double nm01 = rm01;
double nm02 = rm02;
double nm10 = rm10;
double nm11 = rm11;
double nm12 = rm12;
// set non-dependent values directly
dest._m20(rm20)
._m21(rm21)
._m22(rm22)
// set other values
._m00(nm00)
._m01(nm01)
._m02(nm02)
._m03(0.0)
._m10(nm10)
._m11(nm11)
._m12(nm12)
._m13(0.0)
._m30(m30)
._m31(m31)
._m32(m32)
._m33(m33)

assigning from rm** to nm** is completely unnecessary, unless I'm missing something, wouldn't this be fine

// set non-dependent values directly
dest._m20(rm20)
._m21(rm21)
._m22(rm22)
// set other values
._m00(rm00)
._m01(rm01)
._m02(rm02)
._m03(0.0)
._m10(rm10)
._m11(rm11)
._m12(rm12)
._m13(0.0)
._m30(m30)
._m31(m31)
._m32(m32)
._m33(m33)
httpdigest commented 2 years ago

Thanks! You're right. Those variables were unnecessary.