Add internal utility for zeroing int vectors.

Remove unnecessary branches in related functions.

PiperOrigin-RevId: 562768873
Change-Id: I3964a7a953d95bcd4e29137a7b590be5ffa6e311
This commit is contained in:
Yuval Tassa
2023-09-05 07:13:37 -07:00
committed by Copybara-Service
parent f976d6d228
commit d5292976de
10 changed files with 30 additions and 31 deletions
+1 -3
View File
@@ -14,8 +14,6 @@
#include "engine/engine_support.h"
#include <string.h>
#include <mujoco/mjdata.h>
#include <mujoco/mjmacro.h>
#include <mujoco/mjmodel.h>
@@ -1161,7 +1159,7 @@ void mj_copyM2DSparse(const mjModel* m, mjData* d, mjtNum* dst, const mjtNum* sr
// init remaining
int* remaining = mj_stackAllocInt(d, nv);
memcpy(remaining, d->D_rownnz, nv * sizeof(int));
mju_copyInt(remaining, d->D_rownnz, nv);
// copy data
for (int i = nv - 1; i >= 0; i--) {