Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-07 10:37:15

0001 /***************************************************************************
0002  * Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and         *
0003  * Martin Renou                                                             *
0004  * Copyright (c) QuantStack                                                 *
0005  * Copyright (c) Serge Guelton                                              *
0006  *                                                                          *
0007  * Distributed under the terms of the BSD 3-Clause License.                 *
0008  *                                                                          *
0009  * The full license is in the file LICENSE, distributed with this software. *
0010  ****************************************************************************/
0011 
0012 #ifndef XSIMD_MACROS_HPP
0013 #define XSIMD_MACROS_HPP
0014 
0015 #include "./xsimd_config.hpp"
0016 
0017 #if defined(__VEC__)
0018 #define XSIMD_INLINE inline
0019 #elif defined __has_attribute
0020 #if __has_attribute(always_inline)
0021 #define XSIMD_INLINE inline __attribute__((always_inline))
0022 #else
0023 #define XSIMD_INLINE inline
0024 #endif
0025 #elif defined(_MSC_VER)
0026 #define XSIMD_INLINE inline __forceinline
0027 #else
0028 #define XSIMD_INLINE inline
0029 #endif
0030 
0031 #define XSIMD_CONCAT_INNER(a, b) a##b
0032 #define XSIMD_CONCAT(a, b) XSIMD_CONCAT_INNER(a, b)
0033 
0034 #if defined(__FAST_MATH__)
0035 #define XSIMD_NO_DENORMALS
0036 #define XSIMD_NO_INFINITIES
0037 #define XSIMD_NO_NANS
0038 #endif
0039 
0040 #if defined(__has_cpp_attribute)
0041 // if this check passes, then the compiler supports feature test macros
0042 #if __has_cpp_attribute(nodiscard) >= 201603L
0043 // if this check passes, then the compiler supports [[nodiscard]] without a message
0044 #define XSIMD_NO_DISCARD [[nodiscard]]
0045 #endif
0046 #endif
0047 
0048 #if !defined(XSIMD_NO_DISCARD) && XSIMD_CPP_VERSION >= 201703L
0049 // this means that the previous tests failed, but we are using C++17 or higher
0050 #define XSIMD_NO_DISCARD [[nodiscard]]
0051 #endif
0052 
0053 #if !defined(XSIMD_NO_DISCARD) && (defined(__GNUC__) || defined(__clang__))
0054 // this means that the previous checks failed, but we are using GCC or Clang
0055 #define XSIMD_NO_DISCARD __attribute__((warn_unused_result))
0056 #endif
0057 
0058 #if !defined(XSIMD_NO_DISCARD)
0059 // this means that all the previous checks failed, so we fallback to doing nothing
0060 #define XSIMD_NO_DISCARD
0061 #endif
0062 
0063 #ifdef __cpp_if_constexpr
0064 // this means that the compiler supports the `if constexpr` construct
0065 #define XSIMD_IF_CONSTEXPR if constexpr
0066 #endif
0067 
0068 #if !defined(XSIMD_IF_CONSTEXPR) && XSIMD_CPP_VERSION >= 201703L
0069 // this means that the previous test failed, but we are using C++17 or higher
0070 #define XSIMD_IF_CONSTEXPR if constexpr
0071 #endif
0072 
0073 #if !defined(XSIMD_IF_CONSTEXPR)
0074 // this means that all the previous checks failed, so we fallback to a normal `if`
0075 #define XSIMD_IF_CONSTEXPR if
0076 #endif
0077 
0078 #endif