Add internal utility for zeroing int vectors.
Remove unnecessary branches in related functions. PiperOrigin-RevId: 562768873 Change-Id: I3964a7a953d95bcd4e29137a7b590be5ffa6e311
This commit is contained in:
committed by
Copybara-Service
parent
f976d6d228
commit
d5292976de
@@ -238,9 +238,7 @@ mjtNum mju_normalize4(mjtNum vec[4]) {
|
||||
|
||||
// res = 0
|
||||
void mju_zero(mjtNum* res, int n) {
|
||||
if (n > 0) {
|
||||
memset(res, 0, n*sizeof(mjtNum));
|
||||
}
|
||||
memset(res, 0, n*sizeof(mjtNum));
|
||||
}
|
||||
|
||||
|
||||
@@ -256,9 +254,7 @@ void mju_fill(mjtNum* res, mjtNum val, int n) {
|
||||
|
||||
// res = vec
|
||||
void mju_copy(mjtNum* res, const mjtNum* vec, int n) {
|
||||
if (n > 0) {
|
||||
memcpy(res, vec, n*sizeof(mjtNum));
|
||||
}
|
||||
memcpy(res, vec, n*sizeof(mjtNum));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user