3577e2cf8b
PiperOrigin-RevId: 434731612 Change-Id: I0cfda3e7a3d1c72036764986efc252ffa1b8c6b0
48 lines
1.6 KiB
C
48 lines
1.6 KiB
C
// Copyright 2022 DeepMind Technologies Limited
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
#ifndef MUJOCO_PYTHON_UTIL_CROSSPLATFORM_H_
|
|
#define MUJOCO_PYTHON_UTIL_CROSSPLATFORM_H_
|
|
|
|
#ifdef __has_attribute
|
|
#define MUJOCO_HAS_ATTRIBUTE(x) __has_attribute(x)
|
|
#else
|
|
#define MUJOCO_HAS_ATTRIBUTE(x) 0
|
|
#endif
|
|
|
|
#if MUJOCO_HAS_ATTRIBUTE(always_inline) || \
|
|
(defined(__GNUC__) && !defined(__clang__))
|
|
#define MUJOCO_ALWAYS_INLINE __attribute__((always_inline))
|
|
#define MUJOCO_ALWAYS_INLINE_LAMBDA MUJOCO_ALWAYS_INLINE
|
|
#define MUJOCO_ALWAYS_INLINE_LAMBDA_MUTABLE MUJOCO_ALWAYS_INLINE_LAMBDA mutable
|
|
#elif defined(_MSC_VER)
|
|
#define MUJOCO_ALWAYS_INLINE __forceinline
|
|
#if _MSC_VER >= 1927 && _MSVC_LANG >= 202002L
|
|
#define MUJOCO_ALWAYS_INLINE_LAMBDA [[msvc::forceinline]]
|
|
#endif
|
|
#define MUJOCO_ALWAYS_INLINE_LAMBDA_MUTABLE mutable MUJOCO_ALWAYS_INLINE_LAMBDA
|
|
#else
|
|
#define MUJOCO_ALWAYS_INLINE
|
|
#endif
|
|
|
|
#ifndef MUJOCO_ALWAYS_INLINE_LAMBDA
|
|
#define MUJOCO_ALWAYS_INLINE_LAMBDA
|
|
#endif
|
|
|
|
#ifndef MUJOCO_ALWAYS_INLINE_LAMBDA_MUTABLE
|
|
#define MUJOCO_ALWAYS_INLINE_LAMBDA_MUTABLE
|
|
#endif
|
|
|
|
#endif // MUJOCO_PYTHON_UTIL_CROSSPLATFORM_H_
|