diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2024-09-03 20:09:03 +0300 |
---|---|---|
committer | robot-contrib <robot-contrib@yandex-team.com> | 2024-09-03 20:19:03 +0300 |
commit | 2671d03e5d1dc47268068c494d79f6f6250f7d22 (patch) | |
tree | c7cfebf4461d3e6b8dab5a18f4f21aef656de9d1 /contrib/restricted | |
parent | 89322edaa0af5b108223a6ff6533b44456fa1d56 (diff) | |
download | ydb-2671d03e5d1dc47268068c494d79f6f6250f7d22.tar.gz |
Update contrib/restricted/boost/crc to 1.86.0
829c66bdff5d5d29b785fa6625d96d8950a6296c
Diffstat (limited to 'contrib/restricted')
-rw-r--r-- | contrib/restricted/boost/crc/include/boost/crc.hpp | 181 | ||||
-rw-r--r-- | contrib/restricted/boost/crc/ya.make | 11 |
2 files changed, 104 insertions, 88 deletions
diff --git a/contrib/restricted/boost/crc/include/boost/crc.hpp b/contrib/restricted/boost/crc/include/boost/crc.hpp index 727a67235b..e0a22d1731 100644 --- a/contrib/restricted/boost/crc/include/boost/crc.hpp +++ b/contrib/restricted/boost/crc/include/boost/crc.hpp @@ -36,35 +36,58 @@ #ifndef BOOST_CRC_HPP #define BOOST_CRC_HPP -#include <boost/array.hpp> // for boost::array -#include <boost/config.hpp> // for BOOST_STATIC_CONSTANT, etc. -#include <boost/cstdint.hpp> // for UINTMAX_C, boost::uintmax_t -#include <boost/integer.hpp> // for boost::uint_t -#include <boost/type_traits/conditional.hpp> -#include <boost/type_traits/integral_constant.hpp> -#include <boost/config/pragma_message.hpp> +#include <array> // for std::array +#include <climits> // for CHAR_BIT, etc. +#include <cstddef> // for std::size_t +#include <cstdint> // for UINTMAX_C, std::uintmax_t +#include <limits> // for std::numeric_limits +#include <type_traits> // for std::conditional, std::integral_constant -#include <climits> // for CHAR_BIT, etc. -#include <cstddef> // for std::size_t +// Local reimplementation of boost::uint_t, to avoid dependency on Integer -#include <boost/limits.hpp> // for std::numeric_limits +namespace boost { +namespace crc_detail { -#if defined(BOOST_NO_CXX11_HDR_ARRAY) || \ - defined(BOOST_NO_CXX11_NOEXCEPT) // BOOST_NO_CXX11_HDR_TYPE_TRAITS is set for GCC 4.8 +struct uint_t_8 +{ + typedef std::uint8_t fast; +}; + +struct uint_t_16 +{ + typedef std::uint16_t fast; +}; + +struct uint_t_32 +{ + typedef std::uint32_t fast; +}; -BOOST_PRAGMA_MESSAGE("C++03 support is deprecated in Boost.CRC 1.84 and will be removed in Boost.CRC 1.86.") +struct uint_t_64 +{ + typedef std::uint64_t fast; +}; + +struct uint_t_none +{ +}; + +template<int Bits> struct uint_t: + std::conditional< (Bits <= 8), uint_t_8, + typename std::conditional< (Bits <= 16), uint_t_16, + typename std::conditional< (Bits <= 32), uint_t_32, + typename std::conditional< (Bits <= 64), uint_t_64, + uint_t_none>::type>::type>::type>::type +{ +}; -#endif +} // namespace crc_detail +} // namespace boost // The type of CRC parameters that can go in a template should be related // on the CRC's bit count. This macro expresses that type in a compact -// form, but also allows an alternate type for compilers that don't support -// dependent types (in template value-parameters). -#if !(defined(BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS)) -#define BOOST_CRC_PARM_TYPE typename ::boost::uint_t<Bits>::fast -#else -#define BOOST_CRC_PARM_TYPE unsigned long -#endif +// form. +#define BOOST_CRC_PARM_TYPE typename ::boost::crc_detail::uint_t<Bits>::fast namespace boost { @@ -87,14 +110,14 @@ template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly = 0u, template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor, bool ReflectIn, bool ReflectRem > - typename uint_t<Bits>::fast crc( void const *buffer, + typename crc_detail::uint_t<Bits>::fast crc( void const *buffer, std::size_t byte_count); //! Compute the CRC of a memory block, with any augmentation provided by user template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly > - typename uint_t<Bits>::fast augmented_crc( void const *buffer, + typename crc_detail::uint_t<Bits>::fast augmented_crc( void const *buffer, std::size_t byte_count, - typename uint_t<Bits>::fast initial_remainder = 0u); + typename crc_detail::uint_t<Bits>::fast initial_remainder = 0u); //! Computation type for ARC|CRC-16|CRC-IBM|CRC-16/ARC|CRC-16/LHA standard typedef crc_optimal<16, 0x8005, 0, 0, true, true> crc_16_type; @@ -127,7 +150,7 @@ namespace detail class possible_reflector; //! Mix-in class for byte-fed, table-driven CRC algorithms - template < int Order, boost::uintmax_t TruncatedPolynomial, bool Reflect, + template < int Order, std::uintmax_t TruncatedPolynomial, bool Reflect, int Id = 0 > class crc_driver; @@ -159,11 +182,11 @@ public: checksums and returned or submitted remainders, (truncated) divisors, or XOR masks. It is a built-in unsigned integer type. */ - typedef typename boost::uint_t<Bits>::fast value_type; + typedef typename boost::crc_detail::uint_t<Bits>::fast value_type; // Constant for the template parameter //! A copy of \a Bits provided for meta-programming purposes - BOOST_STATIC_CONSTANT( std::size_t, bit_count = Bits ); + static const std::size_t bit_count = Bits; // Constructor (use the automatic copy-ctr, move-ctr, and dtr) //! Create a computer, separately listing each needed parameter @@ -253,21 +276,21 @@ class crc_optimal public: // Type //! \copydoc boost::crc_basic::value_type - typedef typename boost::uint_t<Bits>::fast value_type; + typedef typename boost::crc_detail::uint_t<Bits>::fast value_type; // Constants for the template parameters //! \copydoc boost::crc_basic::bit_count - BOOST_STATIC_CONSTANT( std::size_t, bit_count = Bits ); + static const std::size_t bit_count = Bits; //! A copy of \a TruncPoly provided for meta-programming purposes - BOOST_STATIC_CONSTANT( value_type, truncated_polynominal = TruncPoly ); + static const value_type truncated_polynominal = TruncPoly; //! A copy of \a InitRem provided for meta-programming purposes - BOOST_STATIC_CONSTANT( value_type, initial_remainder = InitRem ); + static const value_type initial_remainder = InitRem; //! A copy of \a FinalXor provided for meta-programming purposes - BOOST_STATIC_CONSTANT( value_type, final_xor_value = FinalXor ); + static const value_type final_xor_value = FinalXor; //! A copy of \a ReflectIn provided for meta-programming purposes - BOOST_STATIC_CONSTANT( bool, reflect_input = ReflectIn ); + static const bool reflect_input = ReflectIn; //! A copy of \a ReflectRem provided for meta-programming purposes - BOOST_STATIC_CONSTANT( bool, reflect_remainder = ReflectRem ); + static const bool reflect_remainder = ReflectRem; // Constructor (use the automatic copy-ctr, move-ctr, and dtr) //! Create a computer, giving an initial remainder if desired @@ -342,7 +365,7 @@ namespace detail */ template < int BitIndex > struct high_bit_mask_c - : boost::integral_constant<typename boost::uint_t< BitIndex + 1 >::fast, + : std::integral_constant<typename boost::crc_detail::uint_t< BitIndex + 1 >::fast, ( UINTMAX_C(1) << BitIndex )> {}; @@ -361,7 +384,7 @@ namespace detail */ template < int BitCount > struct low_bits_mask_c - : boost::integral_constant<typename boost::uint_t< BitCount >::fast, ( + : std::integral_constant<typename boost::crc_detail::uint_t< BitCount >::fast, ( BitCount ? (( (( UINTMAX_C(1) << (BitCount - 1) ) - 1u) << 1 ) | UINTMAX_C( 1 )) : 0u )> {}; @@ -412,10 +435,10 @@ namespace detail <var>i</var>, <code><var>a</var>[ <var>i</var> ]</code> resolves to the reflected value of <var>i</var>. */ - boost::array< unsigned char, (UINTMAX_C( 1 ) << CHAR_BIT) > + std::array< unsigned char, (UINTMAX_C( 1 ) << CHAR_BIT) > inline make_byte_reflection_table() { - boost::array<unsigned char, ( UINTMAX_C(1) << CHAR_BIT )> result; + std::array<unsigned char, ( UINTMAX_C(1) << CHAR_BIT )> result; unsigned char i = 0u; do @@ -441,7 +464,7 @@ namespace detail */ inline unsigned char reflect_byte( unsigned char x ) { - static boost::array<unsigned char, ( UINTMAX_C(1) << CHAR_BIT )> const + static std::array<unsigned char, ( UINTMAX_C(1) << CHAR_BIT )> const table = make_byte_reflection_table(); return table[ x ]; @@ -582,7 +605,7 @@ namespace detail } // Clear overflowed bits - remainder &= std::numeric_limits<Register>::max() >> (std::numeric_limits<Register>::digits - register_length); + remainder &= (std::numeric_limits<Register>::max)() >> (std::numeric_limits<Register>::digits - register_length); } /** \brief Update a CRC remainder by a single bit, assuming a non-augmented @@ -762,19 +785,19 @@ namespace detail This is a Boost integral constant indicating that this class does not reflect its input values. */ - typedef boost::false_type is_reflecting_type; + typedef std::false_type is_reflecting_type; /** \brief The type to check for register bit length This is a Boost integral constant indicating how many significant bits won't actually be reflected. */ - typedef boost::integral_constant< int, BitLength > width_c; + typedef std::integral_constant< int, BitLength > width_c; /** \brief The type of (not-)reflected values This type is the input and output type for the (possible-) reflection function, which does nothing here. */ - typedef typename boost::uint_t< BitLength >::fast value_type; + typedef typename boost::crc_detail::uint_t< BitLength >::fast value_type; /** \brief Does nothing @@ -809,18 +832,18 @@ namespace detail This is a Boost integral constant indicating that this class does reflect its input values. */ - typedef boost::true_type is_reflecting_type; + typedef std::true_type is_reflecting_type; /** \brief The type to check for register bit length This is a Boost integral constant indicating how many significant bits will be reflected. */ - typedef boost::integral_constant< int, BitLength > width_c; + typedef std::integral_constant< int, BitLength > width_c; /** \brief The type of reflected values This is both the input and output type for the reflection function. */ - typedef typename boost::uint_t< BitLength >::fast value_type; + typedef typename boost::crc_detail::uint_t< BitLength >::fast value_type; /** \brief Reflect (part of) the given value @@ -858,13 +881,13 @@ namespace detail This is a Boost integral constant indicating that this class does reflect its input values. */ - typedef boost::true_type is_reflecting_type; + typedef std::true_type is_reflecting_type; /** \brief The type to check for register bit length This is a Boost integral constant indicating how many significant bits will be reflected. */ - typedef boost::integral_constant< int, BitLength > width_c; + typedef std::integral_constant< int, BitLength > width_c; /** \brief The type of reflected values This is both the input and output type for the reflection function. @@ -900,7 +923,7 @@ namespace detail */ template < int BitLength > class reflector - : public boost::conditional< (BitLength > CHAR_BIT), + : public std::conditional< (BitLength > CHAR_BIT), super_byte_reflector<BitLength>, sub_type_reflector<BitLength> >::type { }; @@ -919,7 +942,7 @@ namespace detail */ template < int BitLength, bool DoIt, int Id > class possible_reflector - : public boost::conditional< DoIt, reflector<BitLength>, + : public std::conditional< DoIt, reflector<BitLength>, non_reflector<BitLength> >::type { public: @@ -928,7 +951,7 @@ namespace detail This is a Boost integral constant indicating what ID number this instantiation used. */ - typedef boost::integral_constant<int, Id> id_type; + typedef std::integral_constant<int, Id> id_type; }; /** \brief Find the composite remainder update effect from a fixed bit @@ -974,14 +997,14 @@ namespace detail same composite mask table as using augmented-CRC routines. */ template < int SubOrder, typename Register > - boost::array< Register, (UINTMAX_C( 1 ) << SubOrder) > + std::array< Register, (UINTMAX_C( 1 ) << SubOrder) > make_partial_xor_products_table( int register_length, Register truncated_divisor, bool reflect ) { - boost::array<Register, ( UINTMAX_C(1) << SubOrder )> result = { 0 }; + std::array<Register, ( UINTMAX_C(1) << SubOrder )> result = { 0 }; // Loop over every possible dividend value - for ( typename boost::uint_t<SubOrder + 1>::fast dividend = 0u; + for ( typename boost::crc_detail::uint_t<SubOrder + 1>::fast dividend = 0u; dividend < result.size() ; ++dividend ) { Register remainder = 0u; @@ -1014,7 +1037,7 @@ namespace detail bit from a new dividend's bits and go down, as normal. Otherwise, proceed from the lowest-order bit and go up. */ - template < int Order, int SubOrder, boost::uintmax_t TruncatedPolynomial, + template < int Order, int SubOrder, std::uintmax_t TruncatedPolynomial, bool Reflect > class crc_table_t { @@ -1024,31 +1047,31 @@ namespace detail This is a Boost integral constant indicating how many significant bits are in the remainder and (truncated) divisor. */ - typedef boost::integral_constant< int, Order > width_c; + typedef std::integral_constant< int, Order > width_c; /** \brief The type to check for index-unit bit length This is a Boost integral constant indicating how many significant bits are in the trial new dividends. */ - typedef boost::integral_constant< int, SubOrder > unit_width_c; + typedef std::integral_constant< int, SubOrder > unit_width_c; /** \brief The type of registers This is the output type for the partial-product map. */ - typedef typename boost::uint_t< Order >::fast value_type; + typedef typename boost::crc_detail::uint_t< Order >::fast value_type; /** \brief The type to check the divisor This is a Boost integral constant representing the (truncated) divisor. */ - typedef boost::integral_constant< value_type, TruncatedPolynomial > + typedef std::integral_constant< value_type, TruncatedPolynomial > poly_c; /** \brief The type to check for reflection This is a Boost integral constant representing whether input units should be read in reverse order. */ - typedef boost::integral_constant< bool, Reflect > refin_c; + typedef std::integral_constant< bool, Reflect > refin_c; /** \brief The type to check for map size This is a Boost integral constant representing the number of @@ -1060,7 +1083,7 @@ namespace detail This is the array type that takes units as the index and said unit's composite partial-product mask as the element. */ - typedef boost::array<value_type, table_size_c::value> array_type; + typedef std::array<value_type, table_size_c::value> array_type; /** \brief Create a global array for the mapping table Creates an instance of a partial-product array with this class's @@ -1095,7 +1118,7 @@ namespace detail polynomial. The highest-order coefficient is omitted and always assumed to be 1. */ - template < int Order, boost::uintmax_t TruncatedPolynomial > + template < int Order, std::uintmax_t TruncatedPolynomial > class direct_byte_table_driven_crcs : public crc_table_t<Order, CHAR_BIT, TruncatedPolynomial, false> { @@ -1131,7 +1154,7 @@ namespace detail // Complete the multi-bit modulo-2 polynomial division remainder <<= CHAR_BIT; remainder |= *new_dividend_bytes++; - remainder ^= table.elems[ index ]; + remainder ^= table[ index ]; } return remainder; @@ -1162,7 +1185,7 @@ namespace detail // Complete the multi-bit altered modulo-2 polynomial division remainder = (remainder << CHAR_BIT); - remainder ^= table.elems[ index ]; + remainder ^= table[ index ]; } return remainder; @@ -1185,7 +1208,7 @@ namespace detail polynomial. The highest-order coefficient is omitted and always assumed to be 1. */ - template < int Order, boost::uintmax_t TruncatedPolynomial > + template < int Order, std::uintmax_t TruncatedPolynomial > class reflected_byte_table_driven_crcs : public crc_table_t<Order, CHAR_BIT, TruncatedPolynomial, true> { @@ -1223,7 +1246,7 @@ namespace detail remainder >>= CHAR_BIT; remainder |= static_cast<value_type>( *new_dividend_bytes++ ) << ( Order - CHAR_BIT ); - remainder ^= table.elems[ index ]; + remainder ^= table[ index ]; } return remainder; @@ -1256,7 +1279,7 @@ namespace detail // Complete the multi-bit reflected altered modulo-2 polynomial // division remainder >>= CHAR_BIT; - remainder ^= table.elems[ index ]; + remainder ^= table[ index ]; } return remainder; @@ -1282,9 +1305,9 @@ namespace detail input byte and go down, as normal. Otherwise, proceed from the lowest-order bit and go up. */ - template < int Order, boost::uintmax_t TruncatedPolynomial, bool Reflect > + template < int Order, std::uintmax_t TruncatedPolynomial, bool Reflect > class byte_table_driven_crcs - : public boost::conditional< Reflect, + : public std::conditional< Reflect, reflected_byte_table_driven_crcs<Order, TruncatedPolynomial>, direct_byte_table_driven_crcs<Order, TruncatedPolynomial> >::type { }; @@ -1304,7 +1327,7 @@ namespace detail polynomial. The highest-order coefficient is omitted and always assumed to be 1. */ - template < int Order, boost::uintmax_t TruncatedPolynomial > + template < int Order, std::uintmax_t TruncatedPolynomial > class direct_sub_byte_crcs : public crc_table_t<Order, Order, TruncatedPolynomial, false> { @@ -1387,7 +1410,7 @@ namespace detail polynomial. The highest-order coefficient is omitted and always assumed to be 1. */ - template < int Order, boost::uintmax_t TruncatedPolynomial > + template < int Order, std::uintmax_t TruncatedPolynomial > class reflected_sub_byte_crcs : public crc_table_t<Order, Order, TruncatedPolynomial, true> { @@ -1479,9 +1502,9 @@ namespace detail input byte and go down, as normal. Otherwise, proceed from the lowest-order bit and go up. */ - template < int Order, boost::uintmax_t TruncatedPolynomial, bool Reflect > + template < int Order, std::uintmax_t TruncatedPolynomial, bool Reflect > class sub_byte_crcs - : public boost::conditional< Reflect, + : public std::conditional< Reflect, reflected_sub_byte_crcs<Order, TruncatedPolynomial>, direct_sub_byte_crcs<Order, TruncatedPolynomial> >::type { }; @@ -1503,10 +1526,10 @@ namespace detail \tparam Id An extra differentiator if multiple copies of this class template are mixed-in as base classes. Defaults to 0 if omitted. */ - template < int Order, boost::uintmax_t TruncatedPolynomial, bool Reflect, + template < int Order, std::uintmax_t TruncatedPolynomial, bool Reflect, int Id > class crc_driver - : public boost::conditional< (Order < CHAR_BIT), sub_byte_crcs<Order, + : public std::conditional< (Order < CHAR_BIT), sub_byte_crcs<Order, TruncatedPolynomial, Reflect>, byte_table_driven_crcs<Order, TruncatedPolynomial, Reflect> >::type { @@ -1516,7 +1539,7 @@ namespace detail This is a Boost integral constant indicating what ID number this instantiation used. */ - typedef boost::integral_constant<int, Id> id_type; + typedef std::integral_constant<int, Id> id_type; }; @@ -2227,7 +2250,7 @@ template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, BOOST_CRC_PARM_TYPE InitRem, BOOST_CRC_PARM_TYPE FinalXor, bool ReflectIn, bool ReflectRem > inline -typename uint_t<Bits>::fast +typename crc_detail::uint_t<Bits>::fast crc ( void const * buffer, @@ -2289,12 +2312,12 @@ crc be used only if \c CHAR_BIT divides \a Bits evenly! */ template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly > -typename uint_t<Bits>::fast +typename crc_detail::uint_t<Bits>::fast augmented_crc ( void const * buffer, std::size_t byte_count, - typename uint_t<Bits>::fast initial_remainder // = 0u + typename crc_detail::uint_t<Bits>::fast initial_remainder // = 0u ) { return detail::low_bits_mask_c<Bits>::value & diff --git a/contrib/restricted/boost/crc/ya.make b/contrib/restricted/boost/crc/ya.make index fb251cd435..5576d0964b 100644 --- a/contrib/restricted/boost/crc/ya.make +++ b/contrib/restricted/boost/crc/ya.make @@ -6,16 +6,9 @@ LICENSE(BSL-1.0) LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -VERSION(1.85.0) +VERSION(1.86.0) -ORIGINAL_SOURCE(https://github.com/boostorg/crc/archive/boost-1.85.0.tar.gz) - -PEERDIR( - contrib/restricted/boost/array - contrib/restricted/boost/config - contrib/restricted/boost/integer - contrib/restricted/boost/type_traits -) +ORIGINAL_SOURCE(https://github.com/boostorg/crc/archive/boost-1.86.0.tar.gz) ADDINCL( GLOBAL contrib/restricted/boost/crc/include |