Use std::abs instead of mju_abs to compare integerst in fixture.cc.

PiperOrigin-RevId: 659534808
Change-Id: I4eb9f72078f2d7224bcfd3b537e4053d220750c8
This commit is contained in:
Nimrod Gileadi
2024-08-05 06:34:18 -07:00
committed by Copybara-Service
parent 20011a2f53
commit 0610c1d0e9
+11 -9
View File
@@ -17,6 +17,7 @@
#include <array>
#include <cerrno>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <filesystem> // NOLINT
#include <fstream>
@@ -218,15 +219,16 @@ mjtNum CompareModel(const mjModel* m1, const mjModel* m2,
// (needed in MJMODEL_POINTERS)
MJMODEL_POINTERS_PREAMBLE(m1);
// compare ints, exclude nbuffer because it hides the actual difference
#define X(name) \
if (strncmp(#name, "nbuffer", 7)) { \
if (m1->name != m2->name) { \
maxdif = mju_abs(m1->name - m2->name); field = #name; \
} \
}
MJMODEL_INTS
#undef X
// compare ints, exclude nbuffer because it hides the actual difference
#define X(name) \
if constexpr (std::string_view(#name) != "nbuffer") { \
if (m1->name != m2->name) { \
maxdif = std::abs((long)m1->name - (long)m2->name); \
field = #name; \
} \
}
MJMODEL_INTS
#undef X
if (maxdif > 0) return maxdif;
// compare arrays, apart from bvh-related ones, as those are sensitive to