diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2022-12-22 19:25:59 +0300 |
---|---|---|
committer | robot-contrib <robot-contrib@yandex-team.com> | 2022-12-22 19:25:59 +0300 |
commit | dddccdd54f601383f3d4c752c27e3a1bf11424e7 (patch) | |
tree | 351d54a2b539aa18f986327ebe64641a8fdc8207 | |
parent | f42aa27f6449e25993e7f066bb5e8eaf6c680e5a (diff) | |
download | ydb-dddccdd54f601383f3d4c752c27e3a1bf11424e7.tar.gz |
Update contrib/restricted/boost/core to 1.81.0
-rw-r--r-- | contrib/restricted/boost/core/include/boost/core/bit.hpp | 36 | ||||
-rw-r--r-- | contrib/restricted/boost/core/include/boost/core/empty_value.hpp | 32 |
2 files changed, 48 insertions, 20 deletions
diff --git a/contrib/restricted/boost/core/include/boost/core/bit.hpp b/contrib/restricted/boost/core/include/boost/core/bit.hpp index ddd435b0f4..5d14685934 100644 --- a/contrib/restricted/boost/core/include/boost/core/bit.hpp +++ b/contrib/restricted/boost/core/include/boost/core/bit.hpp @@ -92,6 +92,8 @@ BOOST_CONSTEXPR inline int countl_impl( boost::ulong_long_type x ) BOOST_NOEXCEP template<class T> BOOST_CONSTEXPR int countl_zero( T x ) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed ); + return boost::core::detail::countl_impl( x ); } @@ -169,6 +171,8 @@ inline int countl_impl( boost::uint16_t x ) BOOST_NOEXCEPT template<class T> int countl_zero( T x ) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed ); + BOOST_STATIC_ASSERT( sizeof(T) == sizeof(boost::uint8_t) || sizeof(T) == sizeof(boost::uint16_t) || sizeof(T) == sizeof(boost::uint32_t) || sizeof(T) == sizeof(boost::uint64_t) ); BOOST_IF_CONSTEXPR ( sizeof(T) == sizeof(boost::uint8_t) ) @@ -194,6 +198,8 @@ int countl_zero( T x ) BOOST_NOEXCEPT template<class T> BOOST_CONSTEXPR int countl_one( T x ) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed ); + return boost::core::countl_zero( static_cast<T>( ~x ) ); } @@ -234,6 +240,8 @@ BOOST_CONSTEXPR inline int countr_impl( boost::ulong_long_type x ) BOOST_NOEXCEP template<class T> BOOST_CONSTEXPR int countr_zero( T x ) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed ); + return boost::core::detail::countr_impl( x ); } @@ -304,6 +312,8 @@ inline int countr_impl( boost::uint16_t x ) BOOST_NOEXCEPT template<class T> int countr_zero( T x ) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed ); + BOOST_STATIC_ASSERT( sizeof(T) == sizeof(boost::uint8_t) || sizeof(T) == sizeof(boost::uint16_t) || sizeof(T) == sizeof(boost::uint32_t) || sizeof(T) == sizeof(boost::uint64_t) ); BOOST_IF_CONSTEXPR ( sizeof(T) == sizeof(boost::uint8_t) ) @@ -329,6 +339,8 @@ int countr_zero( T x ) BOOST_NOEXCEPT template<class T> BOOST_CONSTEXPR int countr_one( T x ) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed ); + return boost::core::countr_zero( static_cast<T>( ~x ) ); } @@ -377,6 +389,8 @@ BOOST_CORE_POPCOUNT_CONSTEXPR inline int popcount_impl( boost::ulong_long_type x template<class T> BOOST_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed ); + return boost::core::detail::popcount_impl( x ); } @@ -408,6 +422,8 @@ BOOST_CXX14_CONSTEXPR inline int popcount_impl( boost::uint64_t x ) BOOST_NOEXCE template<class T> BOOST_CXX14_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed ); + BOOST_STATIC_ASSERT( sizeof(T) <= sizeof(boost::uint64_t) ); BOOST_IF_CONSTEXPR ( sizeof(T) <= sizeof(boost::uint32_t) ) @@ -427,6 +443,8 @@ BOOST_CXX14_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT template<class T> BOOST_CXX14_CONSTEXPR T rotl( T x, int s ) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed ); + unsigned const mask = std::numeric_limits<T>::digits - 1; return x << (s & mask) | x >> ((-s) & mask); } @@ -434,6 +452,8 @@ BOOST_CXX14_CONSTEXPR T rotl( T x, int s ) BOOST_NOEXCEPT template<class T> BOOST_CXX14_CONSTEXPR T rotr( T x, int s ) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed ); + unsigned const mask = std::numeric_limits<T>::digits - 1; return x >> (s & mask) | x << ((-s) & mask); } @@ -443,21 +463,27 @@ BOOST_CXX14_CONSTEXPR T rotr( T x, int s ) BOOST_NOEXCEPT template<class T> BOOST_CONSTEXPR bool has_single_bit( T x ) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed ); + return x != 0 && ( x & ( x - 1 ) ) == 0; } -// bit_width should return int, https://cplusplus.github.io/LWG/issue3656 +// bit_width returns `int` now, https://cplusplus.github.io/LWG/issue3656 +// has been applied to C++20 as a DR template<class T> -BOOST_CONSTEXPR T bit_width( T x ) BOOST_NOEXCEPT +BOOST_CONSTEXPR int bit_width( T x ) BOOST_NOEXCEPT { - return static_cast<T>( - std::numeric_limits<T>::digits - boost::core::countl_zero( x ) ); + BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed ); + + return std::numeric_limits<T>::digits - boost::core::countl_zero( x ); } template<class T> BOOST_CONSTEXPR T bit_floor( T x ) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed ); + return x == 0? 0: T(1) << ( boost::core::bit_width( x ) - 1 ); } @@ -510,6 +536,8 @@ BOOST_CXX14_CONSTEXPR inline boost::uint64_t bit_ceil_impl( boost::uint64_t x ) template<class T> BOOST_CXX14_CONSTEXPR T bit_ceil( T x ) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed ); + BOOST_STATIC_ASSERT( sizeof(T) <= sizeof(boost::uint64_t) ); BOOST_IF_CONSTEXPR ( sizeof(T) <= sizeof(boost::uint32_t) ) diff --git a/contrib/restricted/boost/core/include/boost/core/empty_value.hpp b/contrib/restricted/boost/core/include/boost/core/empty_value.hpp index 9dfd442b9f..d8ffa30b4b 100644 --- a/contrib/restricted/boost/core/include/boost/core/empty_value.hpp +++ b/contrib/restricted/boost/core/include/boost/core/empty_value.hpp @@ -56,37 +56,37 @@ public: #if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) empty_value() = default; #else - empty_value() { } + BOOST_CONSTEXPR empty_value() { } #endif - empty_value(boost::empty_init_t) + BOOST_CONSTEXPR empty_value(boost::empty_init_t) : value_() { } #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template<class U, class... Args> - empty_value(boost::empty_init_t, U&& value, Args&&... args) + BOOST_CONSTEXPR empty_value(boost::empty_init_t, U&& value, Args&&... args) : value_(std::forward<U>(value), std::forward<Args>(args)...) { } #else template<class U> - empty_value(boost::empty_init_t, U&& value) + BOOST_CONSTEXPR empty_value(boost::empty_init_t, U&& value) : value_(std::forward<U>(value)) { } #endif #else template<class U> - empty_value(boost::empty_init_t, const U& value) + BOOST_CONSTEXPR empty_value(boost::empty_init_t, const U& value) : value_(value) { } template<class U> - empty_value(boost::empty_init_t, U& value) + BOOST_CONSTEXPR empty_value(boost::empty_init_t, U& value) : value_(value) { } #endif - const T& get() const BOOST_NOEXCEPT { + BOOST_CONSTEXPR const T& get() const BOOST_NOEXCEPT { return value_; } - T& get() BOOST_NOEXCEPT { + BOOST_CXX14_CONSTEXPR T& get() BOOST_NOEXCEPT { return value_; } @@ -104,37 +104,37 @@ public: #if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) empty_value() = default; #else - empty_value() { } + BOOST_CONSTEXPR empty_value() { } #endif - empty_value(boost::empty_init_t) + BOOST_CONSTEXPR empty_value(boost::empty_init_t) : T() { } #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template<class U, class... Args> - empty_value(boost::empty_init_t, U&& value, Args&&... args) + BOOST_CONSTEXPR empty_value(boost::empty_init_t, U&& value, Args&&... args) : T(std::forward<U>(value), std::forward<Args>(args)...) { } #else template<class U> - empty_value(boost::empty_init_t, U&& value) + BOOST_CONSTEXPR empty_value(boost::empty_init_t, U&& value) : T(std::forward<U>(value)) { } #endif #else template<class U> - empty_value(boost::empty_init_t, const U& value) + BOOST_CONSTEXPR empty_value(boost::empty_init_t, const U& value) : T(value) { } template<class U> - empty_value(boost::empty_init_t, U& value) + BOOST_CONSTEXPR empty_value(boost::empty_init_t, U& value) : T(value) { } #endif - const T& get() const BOOST_NOEXCEPT { + BOOST_CONSTEXPR const T& get() const BOOST_NOEXCEPT { return *this; } - T& get() BOOST_NOEXCEPT { + BOOST_CXX14_CONSTEXPR T& get() BOOST_NOEXCEPT { return *this; } }; |