Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 08:39:10

0001 //  Copyright (c) 2024 Matt Borland
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_UTILITY
0007 #define BOOST_MATH_TOOLS_UTILITY
0008 
0009 #include <boost/math/tools/config.hpp>
0010 
0011 #ifndef BOOST_MATH_HAS_GPU_SUPPORT
0012 
0013 #include <utility>
0014 
0015 namespace boost {
0016 namespace math {
0017 
0018 template <typename T>
0019 constexpr T min BOOST_MATH_PREVENT_MACRO_SUBSTITUTION (const T& a, const T& b)
0020 {
0021     return (std::min)(a, b);
0022 }
0023 
0024 template <typename T>
0025 constexpr T max BOOST_MATH_PREVENT_MACRO_SUBSTITUTION (const T& a, const T& b)
0026 {
0027     return (std::max)(a, b);
0028 }
0029 
0030 template <typename T>
0031 void swap BOOST_MATH_PREVENT_MACRO_SUBSTITUTION (T& a, T& b)
0032 {
0033     return (std::swap)(a, b);
0034 }
0035 
0036 } // namespace math
0037 } // namespace boost
0038 
0039 #else
0040 
0041 namespace boost {
0042 namespace math {
0043 
0044 template <typename T>
0045 BOOST_MATH_GPU_ENABLED constexpr T min BOOST_MATH_PREVENT_MACRO_SUBSTITUTION (const T& a, const T& b)
0046 { 
0047     return a < b ? a : b; 
0048 }
0049 
0050 template <typename T>
0051 BOOST_MATH_GPU_ENABLED constexpr T max BOOST_MATH_PREVENT_MACRO_SUBSTITUTION (const T& a, const T& b)
0052 { 
0053     return a > b ? a : b;
0054 }
0055 
0056 template <typename T>
0057 BOOST_MATH_GPU_ENABLED constexpr void swap BOOST_MATH_PREVENT_MACRO_SUBSTITUTION (T& a, T& b)
0058 { 
0059     T t(a); 
0060     a = b; 
0061     b = t;
0062 }
0063 
0064 } // namespace math
0065 } // namespace boost
0066 
0067 #endif // BOOST_MATH_HAS_GPU_SUPPORT
0068 
0069 #endif // BOOST_MATH_TOOLS_UTILITY