Make SameVector return early.

PiperOrigin-RevId: 619128273
Change-Id: Ic47613b8322b9ff5a6a1f557cc9626a20aaee794
This commit is contained in:
Kyle Bayes
2024-03-26 03:18:21 -07:00
committed by Copybara-Service
parent 357ff8bbdc
commit 709719911e
+3 -4
View File
@@ -523,14 +523,13 @@ bool mjXUtil::SameVector(const T* vec1, const T* vec2, int n) {
return false;
}
bool same = true;
for (int i=0; i<n; i++) {
for (int i = 0; i < n; i++) {
if (std::abs(vec1[i] - vec2[i]) > std::numeric_limits<T>::epsilon()) {
same = false;
return false;
}
}
return same;
return true;
}
template bool mjXUtil::SameVector(const double* vec1, const double* vec2, int n);