Clean up X macros and usages for mjOption, mjStatistic, and mjVisual.
* Replace various MJOPTION_ macros with a single MJOPTION_FIELDS. * Use XVEC macro to denote vector members where there is a mixture of vector and scalar members in a given struct type. * Split up MJVISUAL_FIELDS into separate macros for each substruct. * Modify engine_print.c and Python bindings struct.h/cc to use the new X macros. PiperOrigin-RevId: 869760513 Change-Id: Idac4fe9aa99f0258e7c79802ca9023a0d4486e2d
This commit is contained in:
committed by
Copybara-Service
parent
6d8b6028e2
commit
5274e5f720
+5
-8
@@ -274,19 +274,16 @@ mjtNum CompareModel(const mjModel* m1, const mjModel* m2,
|
||||
MJMODEL_POINTERS
|
||||
#undef X
|
||||
|
||||
// compare scalars in mjOption
|
||||
#define X(type, name) \
|
||||
// compare fields in mjOption
|
||||
#define X(type, name, n) \
|
||||
dif = Compare(m1->opt.name, m2->opt.name); \
|
||||
if (dif > maxdif) {maxdif = dif; field = #name;}
|
||||
MJOPTION_SCALARS
|
||||
#undef X
|
||||
|
||||
// compare arrays in mjOption
|
||||
#define X(name, n) \
|
||||
#define XVEC(type, name, n) \
|
||||
for (int c=0; c < n; c++) { \
|
||||
dif = Compare(m1->opt.name[c], m2->opt.name[c]); \
|
||||
if (dif > maxdif) {maxdif = dif; field = #name;} }
|
||||
MJOPTION_VECTORS
|
||||
MJOPTION_FIELDS
|
||||
#undef XVEC
|
||||
#undef X
|
||||
|
||||
// Return largest difference and field name
|
||||
|
||||
Reference in New Issue
Block a user