Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:40:40

0001 //  Copyright John Maddock 2011-2021.
0002 //  Use, modification and distribution are subject to the
0003 //  Boost Software License, Version 1.0. (See accompanying file
0004 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 #ifndef BOOST_MATH_TOOLS_IS_CONSTANT_EVALUATED_HPP
0007 #define BOOST_MATH_TOOLS_IS_CONSTANT_EVALUATED_HPP
0008 
0009 #include <boost/math/tools/config.hpp>
0010 
0011 #ifdef __has_include
0012 # if __has_include(<version>)
0013 #  include <version>
0014 #  ifdef __cpp_lib_is_constant_evaluated
0015 #   include <type_traits>
0016 #   define BOOST_MATH_HAS_IS_CONSTANT_EVALUATED
0017 #  endif
0018 # endif
0019 #endif
0020 
0021 #ifdef __has_builtin
0022 #  if __has_builtin(__builtin_is_constant_evaluated) && !defined(BOOST_NO_CXX14_CONSTEXPR) && !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
0023 #    define BOOST_MATH_HAS_BUILTIN_IS_CONSTANT_EVALUATED
0024 #  endif
0025 #endif
0026 //
0027 // MSVC also supports __builtin_is_constant_evaluated if it's recent enough:
0028 //
0029 #if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 192528326)
0030 #  define BOOST_MATH_HAS_BUILTIN_IS_CONSTANT_EVALUATED
0031 #endif
0032 //
0033 // As does GCC-9:
0034 //
0035 #if !defined(BOOST_NO_CXX14_CONSTEXPR) && (__GNUC__ >= 9) && !defined(BOOST_MATH_HAS_BUILTIN_IS_CONSTANT_EVALUATED)
0036 #  define BOOST_MATH_HAS_BUILTIN_IS_CONSTANT_EVALUATED
0037 #endif
0038 
0039 #if defined(BOOST_MATH_HAS_IS_CONSTANT_EVALUATED) && !defined(BOOST_NO_CXX14_CONSTEXPR)
0040 #  define BOOST_MATH_IS_CONSTANT_EVALUATED(x) std::is_constant_evaluated()
0041 #elif defined(BOOST_MATH_HAS_BUILTIN_IS_CONSTANT_EVALUATED)
0042 #  define BOOST_MATH_IS_CONSTANT_EVALUATED(x) __builtin_is_constant_evaluated()
0043 #elif !defined(BOOST_NO_CXX14_CONSTEXPR) && (__GNUC__ >= 6)
0044 #  define BOOST_MATH_IS_CONSTANT_EVALUATED(x) __builtin_constant_p(x)
0045 #  define BOOST_MATH_USING_BUILTIN_CONSTANT_P
0046 #else
0047 #  define BOOST_MATH_IS_CONSTANT_EVALUATED(x) false
0048 #  define BOOST_MATH_NO_CONSTEXPR_DETECTION
0049 #endif
0050 
0051 #endif // BOOST_MATH_TOOLS_IS_CONSTANT_EVALUATED_HPP