Remove goto statement from engine collision code.

PiperOrigin-RevId: 688539516
Change-Id: I29b5dd39acccde59df2dbcaf5e866eb6a0406c43
This commit is contained in:
Kyle Bayes
2024-10-22 07:21:19 -07:00
committed by Copybara-Service
parent bfa78614c8
commit 708fd83a49
+2 -7
View File
@@ -1243,11 +1243,7 @@ int mj_broadphase(const mjModel* m, mjData* d, int* bfpair, int maxpair) {
} }
} }
// nothing collidable if (ncollide > 1) {
if (ncollide < 2) {
goto endbroad;
}
// allocate and construct AAMMs for collidable only // allocate and construct AAMMs for collidable only
mjtNum* aamm = mj_stackAllocNum(d, 6*ncollide); mjtNum* aamm = mj_stackAllocNum(d, 6*ncollide);
for (int i=0; i < ncollide; i++) { for (int i=0; i < ncollide; i++) {
@@ -1283,8 +1279,7 @@ int mj_broadphase(const mjModel* m, mjData* d, int* bfpair, int maxpair) {
// add bodyflex pair if there is room in buffer // add bodyflex pair if there is room in buffer
add_pair(m, bf1, bf2, &npair, bfpair, maxpair); add_pair(m, bf1, bf2, &npair, bfpair, maxpair);
} }
}
endbroad:
// sort bodyflex pairs by signature // sort bodyflex pairs by signature
if (npair > 1) { if (npair > 1) {