From 30357c38a309207f4710918269e6834e9e3f1df8 Mon Sep 17 00:00:00 2001 From: Michael Moss Date: Wed, 17 Jun 2026 03:28:10 -0700 Subject: [PATCH] Silence C++20 deprecation warnings in MuJoCo Python enums. PiperOrigin-RevId: 933618689 Change-Id: I7cd99ed47748a56990bef9e390a6c9072d5a6c0a --- python/mujoco/enums.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/mujoco/enums.cc b/python/mujoco/enums.cc index 640e7c0c..5227fe50 100644 --- a/python/mujoco/enums.cc +++ b/python/mujoco/enums.cc @@ -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(a, b) * b; + return static_cast(a) - FloorDiv(static_cast(a), b) * b; }); e.def("__mod__", [](const typename Trait::type& a, double b) -> double { - return a - FloorDiv(a, b) * b; + return static_cast(a) - FloorDiv(static_cast(a), b) * b; }); e.def("__rmod__", [](const typename Trait::type& b, std::int64_t a) -> std::int64_t { - return a - FloorDiv(a, b) * b; + return a - FloorDiv(a, static_cast(b)) * static_cast(b); }); e.def("__rmod__", [](const typename Trait::type& b, double a) -> double { - return a - FloorDiv(a, b) * b; + return a - FloorDiv(a, static_cast(b)) * static_cast(b); }); // Bitwise operators