Silence C++20 deprecation warnings in MuJoCo Python enums.

PiperOrigin-RevId: 933618689
Change-Id: I7cd99ed47748a56990bef9e390a6c9072d5a6c0a
This commit is contained in:
Michael Moss
2026-06-17 03:28:10 -07:00
committed by Copybara-Service
parent 386b45fb75
commit 30357c38a3
+4 -4
View File
@@ -106,19 +106,19 @@ void DefEnum(py::module_& m) {
});
e.def("__mod__",
[](const typename Trait::type& a, std::int64_t b) -> std::int64_t {
return a - FloorDiv<std::int64_t>(a, b) * b;
return static_cast<std::int64_t>(a) - FloorDiv<std::int64_t>(static_cast<std::int64_t>(a), b) * b;
});
e.def("__mod__",
[](const typename Trait::type& a, double b) -> double {
return a - FloorDiv<double>(a, b) * b;
return static_cast<double>(a) - FloorDiv<double>(static_cast<double>(a), b) * b;
});
e.def("__rmod__",
[](const typename Trait::type& b, std::int64_t a) -> std::int64_t {
return a - FloorDiv<std::int64_t>(a, b) * b;
return a - FloorDiv<std::int64_t>(a, static_cast<std::int64_t>(b)) * static_cast<std::int64_t>(b);
});
e.def("__rmod__",
[](const typename Trait::type& b, double a) -> double {
return a - FloorDiv<double>(a, b) * b;
return a - FloorDiv<double>(a, static_cast<double>(b)) * static_cast<double>(b);
});
// Bitwise operators