Use int_least32_t in atomic_count_sync; prefer it to atomic_count_gcc_x86; mark latter obsolete

This commit is contained in:
Peter Dimov
2020-06-07 06:05:17 +03:00
parent 00db1e02c6
commit 7c01e640f7
3 changed files with 13 additions and 5 deletions

View File

@@ -76,12 +76,12 @@
#elif !defined( BOOST_NO_CXX11_HDR_ATOMIC ) #elif !defined( BOOST_NO_CXX11_HDR_ATOMIC )
# include <boost/smart_ptr/detail/atomic_count_std_atomic.hpp> # include <boost/smart_ptr/detail/atomic_count_std_atomic.hpp>
#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) && !defined( __PATHSCALE__ )
# include <boost/smart_ptr/detail/atomic_count_gcc_x86.hpp>
#elif defined( BOOST_SP_HAS_SYNC_INTRINSICS ) #elif defined( BOOST_SP_HAS_SYNC_INTRINSICS )
# include <boost/smart_ptr/detail/atomic_count_sync.hpp> # include <boost/smart_ptr/detail/atomic_count_sync.hpp>
#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) && !defined( __PATHSCALE__ )
# include <boost/smart_ptr/detail/atomic_count_gcc_x86.hpp>
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# include <boost/smart_ptr/detail/atomic_count_win32.hpp> # include <boost/smart_ptr/detail/atomic_count_win32.hpp>

View File

@@ -13,6 +13,8 @@
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
// //
#include <boost/smart_ptr/detail/sp_obsolete.hpp>
#if defined(BOOST_SP_REPORT_IMPLEMENTATION) #if defined(BOOST_SP_REPORT_IMPLEMENTATION)
#include <boost/config/pragma_message.hpp> #include <boost/config/pragma_message.hpp>
@@ -20,6 +22,8 @@ BOOST_PRAGMA_MESSAGE("Using g++/x86 atomic_count")
#endif #endif
BOOST_SP_OBSOLETE()
namespace boost namespace boost
{ {

View File

@@ -15,6 +15,8 @@
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
// //
#include <boost/cstdint.hpp>
#if defined( __ia64__ ) && defined( __INTEL_COMPILER ) #if defined( __ia64__ ) && defined( __INTEL_COMPILER )
# include <ia64intrin.h> # include <ia64intrin.h>
#endif #endif
@@ -36,7 +38,9 @@ class atomic_count
{ {
public: public:
explicit atomic_count( long v ) : value_( v ) {} explicit atomic_count( long v ) : value_( static_cast< boost::int_least32_t >( v ) )
{
}
long operator++() long operator++()
{ {
@@ -58,7 +62,7 @@ private:
atomic_count(atomic_count const &); atomic_count(atomic_count const &);
atomic_count & operator=(atomic_count const &); atomic_count & operator=(atomic_count const &);
mutable long value_; mutable boost::int_least32_t value_;
}; };
} // namespace detail } // namespace detail