Add private function mju_fillInt

PiperOrigin-RevId: 845217293
Change-Id: I604372ab7ea7f4d47d9427d36dc8cd78e60d84ca
This commit is contained in:
Yuval Tassa
2025-12-16 05:15:57 -08:00
committed by Copybara-Service
parent 477a14dcb2
commit 2b9940bc67
9 changed files with 26 additions and 37 deletions
+7 -3
View File
@@ -1394,6 +1394,12 @@ void mju_copyInt(int* res, const int* vec, int n) {
memcpy(res, vec, n*sizeof(int));
}
// fill int vector with val
void mju_fillInt(int* res, int val, int n) {
for (int i = 0; i < n; i++) {
res[i] = val;
}
}
// standard normal random number generator (optional second number)
mjtNum mju_standardNormal(mjtNum* num2) {
@@ -1521,9 +1527,7 @@ void mju_lower2SymMap(int* map, int nr,
// default all map entries to "no source"
int nnz = res_rowadr[nr-1] + res_rownnz[nr-1];
for (int i = 0; i < nnz; i++) {
map[i] = -1;
}
mju_fillInt(map, -1, nnz);
// initialize per-row cursor
for (int i = 0; i < nr; i++) {