Avoid unnecessary copies after of mju_mulQuat.

Since fdbbc8bbe0, mju_mulQuat allows in-place computations.
There were a few places where the result was unnecessarily assigned to a temporary variable.

PiperOrigin-RevId: 477746005
Change-Id: I7351ef4796e7d70a4a54b930037bfaadee781f12
This commit is contained in:
Nimrod Gileadi
2022-09-29 09:33:12 -07:00
committed by Copybara-Service
parent 48f2ed99a5
commit 8a8305d3ca
5 changed files with 11 additions and 15 deletions
+2 -4
View File
@@ -493,8 +493,7 @@ int mju_eig3(mjtNum* eigval, mjtNum* eigvec, mjtNum quat[4], const mjtNum mat[9]
mju_normalize4(tmp);
// accumulate quaternion rotation
mju_mulQuat(tmp+4, quat, tmp);
mju_copy4(quat, tmp+4);
mju_mulQuat(quat, quat, tmp);
mju_normalize4(quat);
}
@@ -512,8 +511,7 @@ int mju_eig3(mjtNum* eigval, mjtNum* eigvec, mjtNum quat[4], const mjtNum mat[9]
tmp[0] = 0.707106781186548; // mju_cos(pi/4) = mju_sin(pi/4)
tmp[1] = tmp[2] = tmp[3] = 0;
tmp[(j1+2)%3+1] = tmp[0];
mju_mulQuat(tmp+4, quat, tmp);
mju_copy4(quat, tmp+4);
mju_mulQuat(quat, quat, tmp);
mju_normalize4(quat);
}
}