This PR adds the code of Boost.Math as of version 1.89 into the third-party directory, as discussed in a recent RFC [1]. The goal is for this code to be used as a back-end for the C++17 Math Special Functions. As explained in third-paty/README.md, this code is cleared for usage inside libc++ for the Math Special functions, however the LLVM Foundation should be consulted before using this code anywhere else in the LLVM project, due to the fact that it is under the Boost Software License (as opposed to the usual LLVM license). See the RFC [1] for more details. [1]: https://discourse.llvm.org/t/rfc-libc-taking-a-dependency-on-boost-math-for-the-c-17-math-special-functions
51 lines
2.0 KiB
C++
51 lines
2.0 KiB
C++
///////////////////////////////////////////////////////////////////////////////
|
|
// Copyright 2017 John Maddock
|
|
// Distributed under the Boost
|
|
// Software License, Version 1.0. (See accompanying file
|
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
#ifndef BOOST_MATH_ATOMIC_DETAIL_HPP
|
|
#define BOOST_MATH_ATOMIC_DETAIL_HPP
|
|
|
|
#include <boost/math/tools/config.hpp>
|
|
#include <boost/math/tools/cxx03_warn.hpp>
|
|
|
|
#ifdef BOOST_MATH_HAS_THREADS
|
|
#include <atomic>
|
|
|
|
namespace boost {
|
|
namespace math {
|
|
namespace detail {
|
|
#if (ATOMIC_INT_LOCK_FREE == 2) && !defined(BOOST_MATH_NO_ATOMIC_INT)
|
|
typedef std::atomic<int> atomic_counter_type;
|
|
typedef std::atomic<unsigned> atomic_unsigned_type;
|
|
typedef int atomic_integer_type;
|
|
typedef unsigned atomic_unsigned_integer_type;
|
|
#elif (ATOMIC_SHORT_LOCK_FREE == 2) && !defined(BOOST_MATH_NO_ATOMIC_INT)
|
|
typedef std::atomic<short> atomic_counter_type;
|
|
typedef std::atomic<unsigned short> atomic_unsigned_type;
|
|
typedef short atomic_integer_type;
|
|
typedef unsigned short atomic_unsigned_type;
|
|
#elif (ATOMIC_LONG_LOCK_FREE == 2) && !defined(BOOST_MATH_NO_ATOMIC_INT)
|
|
typedef std::atomic<long> atomic_unsigned_integer_type;
|
|
typedef std::atomic<unsigned long> atomic_unsigned_type;
|
|
typedef unsigned long atomic_unsigned_type;
|
|
typedef long atomic_integer_type;
|
|
#elif (ATOMIC_LLONG_LOCK_FREE == 2) && !defined(BOOST_MATH_NO_ATOMIC_INT)
|
|
typedef std::atomic<long long> atomic_unsigned_integer_type;
|
|
typedef std::atomic<unsigned long long> atomic_unsigned_type;
|
|
typedef long long atomic_integer_type;
|
|
typedef unsigned long long atomic_unsigned_integer_type;
|
|
#elif !defined(BOOST_MATH_NO_ATOMIC_INT)
|
|
# define BOOST_MATH_NO_ATOMIC_INT
|
|
#endif
|
|
} // Namespace detail
|
|
} // Namespace math
|
|
} // Namespace boost
|
|
|
|
#else
|
|
# define BOOST_MATH_NO_ATOMIC_INT
|
|
#endif // BOOST_MATH_HAS_THREADS
|
|
|
|
#endif // BOOST_MATH_ATOMIC_DETAIL_HPP
|