boost/predef/detail/endian_compat.h is deprecated; switch to boost/predef/other/endian.h

This commit is contained in:
Peter Dimov
2018-09-11 18:54:54 +03:00
parent f6998d2406
commit 07ec535600
5 changed files with 28 additions and 28 deletions

View File

@@ -35,7 +35,7 @@
#endif #endif
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/predef/detail/endian_compat.h> #include <boost/predef/other/endian.h>
#include <boost/endian/conversion.hpp> #include <boost/endian/conversion.hpp>
#include <boost/endian/buffers.hpp> #include <boost/endian/buffers.hpp>
#define BOOST_ENDIAN_MINIMAL_COVER_OPERATORS #define BOOST_ENDIAN_MINIMAL_COVER_OPERATORS
@@ -146,7 +146,7 @@ namespace endian
typedef endian_arithmetic<order::little, uint_least64_t, 56> little_uint56_t; typedef endian_arithmetic<order::little, uint_least64_t, 56> little_uint56_t;
typedef endian_arithmetic<order::little, uint_least64_t, 64> little_uint64_t; typedef endian_arithmetic<order::little, uint_least64_t, 64> little_uint64_t;
# ifdef BOOST_BIG_ENDIAN # if BOOST_ENDIAN_BIG_BYTE
// native endian signed integer unaligned types // native endian signed integer unaligned types
typedef big_int8_t native_int8_t; typedef big_int8_t native_int8_t;
typedef big_int16_t native_int16_t; typedef big_int16_t native_int16_t;

View File

@@ -35,7 +35,7 @@
#endif #endif
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/predef/detail/endian_compat.h> #include <boost/predef/other/endian.h>
#include <boost/endian/conversion.hpp> #include <boost/endian/conversion.hpp>
#include <boost/type_traits/is_signed.hpp> #include <boost/type_traits/is_signed.hpp>
#include <boost/type_traits/make_unsigned.hpp> #include <boost/type_traits/make_unsigned.hpp>
@@ -148,7 +148,7 @@ namespace endian
typedef endian_buffer<order::little, uint_least64_t, 56> little_uint56_buf_t; typedef endian_buffer<order::little, uint_least64_t, 56> little_uint56_buf_t;
typedef endian_buffer<order::little, uint_least64_t, 64> little_uint64_buf_t; typedef endian_buffer<order::little, uint_least64_t, 64> little_uint64_buf_t;
# ifdef BOOST_BIG_ENDIAN # if BOOST_ENDIAN_BIG_BYTE
// unaligned native endian signed integer buffers // unaligned native endian signed integer buffers
typedef big_int8_buf_t native_int8_buf_t; typedef big_int8_buf_t native_int8_buf_t;
typedef big_int16_buf_t native_int16_buf_t; typedef big_int16_buf_t native_int16_buf_t;

View File

@@ -9,7 +9,7 @@
#define BOOST_ENDIAN_CONVERSION_HPP #define BOOST_ENDIAN_CONVERSION_HPP
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/predef/detail/endian_compat.h> #include <boost/predef/other/endian.h>
#include <boost/cstdint.hpp> #include <boost/cstdint.hpp>
#include <boost/endian/detail/intrinsic.hpp> #include <boost/endian/detail/intrinsic.hpp>
#include <boost/core/scoped_enum.hpp> #include <boost/core/scoped_enum.hpp>
@@ -26,7 +26,7 @@ namespace endian
BOOST_SCOPED_ENUM_START(order) BOOST_SCOPED_ENUM_START(order)
{ {
big, little, big, little,
# ifdef BOOST_BIG_ENDIAN # if BOOST_ENDIAN_BIG_BYTE
native = big native = big
# else # else
native = little native = little
@@ -285,7 +285,7 @@ namespace endian
template <class EndianReversible > template <class EndianReversible >
inline EndianReversible big_to_native(EndianReversible x) BOOST_NOEXCEPT inline EndianReversible big_to_native(EndianReversible x) BOOST_NOEXCEPT
{ {
# ifdef BOOST_BIG_ENDIAN # if BOOST_ENDIAN_BIG_BYTE
return x; return x;
# else # else
return endian_reverse(x); return endian_reverse(x);
@@ -295,7 +295,7 @@ namespace endian
template <class EndianReversible > template <class EndianReversible >
inline EndianReversible native_to_big(EndianReversible x) BOOST_NOEXCEPT inline EndianReversible native_to_big(EndianReversible x) BOOST_NOEXCEPT
{ {
# ifdef BOOST_BIG_ENDIAN # if BOOST_ENDIAN_BIG_BYTE
return x; return x;
# else # else
return endian_reverse(x); return endian_reverse(x);
@@ -305,7 +305,7 @@ namespace endian
template <class EndianReversible > template <class EndianReversible >
inline EndianReversible little_to_native(EndianReversible x) BOOST_NOEXCEPT inline EndianReversible little_to_native(EndianReversible x) BOOST_NOEXCEPT
{ {
# ifdef BOOST_LITTLE_ENDIAN # if BOOST_ENDIAN_LITTLE_BYTE
return x; return x;
# else # else
return endian_reverse(x); return endian_reverse(x);
@@ -315,7 +315,7 @@ namespace endian
template <class EndianReversible > template <class EndianReversible >
inline EndianReversible native_to_little(EndianReversible x) BOOST_NOEXCEPT inline EndianReversible native_to_little(EndianReversible x) BOOST_NOEXCEPT
{ {
# ifdef BOOST_LITTLE_ENDIAN # if BOOST_ENDIAN_LITTLE_BYTE
return x; return x;
# else # else
return endian_reverse(x); return endian_reverse(x);
@@ -370,14 +370,14 @@ namespace endian
} }
template <class EndianReversibleInplace> template <class EndianReversibleInplace>
# ifdef BOOST_BIG_ENDIAN # if BOOST_ENDIAN_BIG_BYTE
inline void big_to_native_inplace(EndianReversibleInplace&) BOOST_NOEXCEPT {} inline void big_to_native_inplace(EndianReversibleInplace&) BOOST_NOEXCEPT {}
# else # else
inline void big_to_native_inplace(EndianReversibleInplace& x) BOOST_NOEXCEPT inline void big_to_native_inplace(EndianReversibleInplace& x) BOOST_NOEXCEPT
{ endian_reverse_inplace(x); } { endian_reverse_inplace(x); }
# endif # endif
template <class EndianReversibleInplace> template <class EndianReversibleInplace>
# ifdef BOOST_BIG_ENDIAN # if BOOST_ENDIAN_BIG_BYTE
inline void native_to_big_inplace(EndianReversibleInplace&) BOOST_NOEXCEPT {} inline void native_to_big_inplace(EndianReversibleInplace&) BOOST_NOEXCEPT {}
# else # else
inline void native_to_big_inplace(EndianReversibleInplace& x) BOOST_NOEXCEPT inline void native_to_big_inplace(EndianReversibleInplace& x) BOOST_NOEXCEPT
@@ -387,14 +387,14 @@ namespace endian
# endif # endif
template <class EndianReversibleInplace> template <class EndianReversibleInplace>
# ifdef BOOST_LITTLE_ENDIAN # if BOOST_ENDIAN_LITTLE_BYTE
inline void little_to_native_inplace(EndianReversibleInplace&) BOOST_NOEXCEPT {} inline void little_to_native_inplace(EndianReversibleInplace&) BOOST_NOEXCEPT {}
# else # else
inline void little_to_native_inplace(EndianReversibleInplace& x) BOOST_NOEXCEPT inline void little_to_native_inplace(EndianReversibleInplace& x) BOOST_NOEXCEPT
{ endian_reverse_inplace(x); } { endian_reverse_inplace(x); }
# endif # endif
template <class EndianReversibleInplace> template <class EndianReversibleInplace>
# ifdef BOOST_LITTLE_ENDIAN # if BOOST_ENDIAN_LITTLE_BYTE
inline void native_to_little_inplace(EndianReversibleInplace&) BOOST_NOEXCEPT {} inline void native_to_little_inplace(EndianReversibleInplace&) BOOST_NOEXCEPT {}
# else # else
inline void native_to_little_inplace(EndianReversibleInplace& x) BOOST_NOEXCEPT inline void native_to_little_inplace(EndianReversibleInplace& x) BOOST_NOEXCEPT
@@ -449,7 +449,7 @@ namespace endian
template <class T> template <class T>
inline void big_reverse_copy(T from, char* to) BOOST_NOEXCEPT inline void big_reverse_copy(T from, char* to) BOOST_NOEXCEPT
{ {
# ifdef BOOST_BIG_ENDIAN # if BOOST_ENDIAN_BIG_BYTE
std::memcpy(to, reinterpret_cast<const char*>(&from), sizeof(T)); std::memcpy(to, reinterpret_cast<const char*>(&from), sizeof(T));
# else # else
std::reverse_copy(reinterpret_cast<const char*>(&from), std::reverse_copy(reinterpret_cast<const char*>(&from),
@@ -459,7 +459,7 @@ namespace endian
template <class T> template <class T>
inline void big_reverse_copy(const char* from, T& to) BOOST_NOEXCEPT inline void big_reverse_copy(const char* from, T& to) BOOST_NOEXCEPT
{ {
# ifdef BOOST_BIG_ENDIAN # if BOOST_ENDIAN_BIG_BYTE
std::memcpy(reinterpret_cast<char*>(&to), from, sizeof(T)); std::memcpy(reinterpret_cast<char*>(&to), from, sizeof(T));
# else # else
std::reverse_copy(from, from + sizeof(T), reinterpret_cast<char*>(&to)); std::reverse_copy(from, from + sizeof(T), reinterpret_cast<char*>(&to));
@@ -468,7 +468,7 @@ namespace endian
template <class T> template <class T>
inline void little_reverse_copy(T from, char* to) BOOST_NOEXCEPT inline void little_reverse_copy(T from, char* to) BOOST_NOEXCEPT
{ {
# ifdef BOOST_LITTLE_ENDIAN # if BOOST_ENDIAN_LITTLE_BYTE
std::memcpy(to, reinterpret_cast<const char*>(&from), sizeof(T)); std::memcpy(to, reinterpret_cast<const char*>(&from), sizeof(T));
# else # else
std::reverse_copy(reinterpret_cast<const char*>(&from), std::reverse_copy(reinterpret_cast<const char*>(&from),
@@ -478,7 +478,7 @@ namespace endian
template <class T> template <class T>
inline void little_reverse_copy(const char* from, T& to) BOOST_NOEXCEPT inline void little_reverse_copy(const char* from, T& to) BOOST_NOEXCEPT
{ {
# ifdef BOOST_LITTLE_ENDIAN # if BOOST_ENDIAN_LITTLE_BYTE
std::memcpy(reinterpret_cast<char*>(&to), from, sizeof(T)); std::memcpy(reinterpret_cast<char*>(&to), from, sizeof(T));
# else # else
std::reverse_copy(from, from + sizeof(T), reinterpret_cast<char*>(&to)); std::reverse_copy(from, from + sizeof(T), reinterpret_cast<char*>(&to));

View File

@@ -34,7 +34,7 @@ namespace
void native_value(int8_t& x) {x = static_cast<int8_t>(0xF0U);} void native_value(int8_t& x) {x = static_cast<int8_t>(0xF0U);}
void native_value(uint8_t& x) {x = static_cast<uint8_t>(0xF0U);} void native_value(uint8_t& x) {x = static_cast<uint8_t>(0xF0U);}
# ifdef BOOST_BIG_ENDIAN # if BOOST_ENDIAN_BIG_BYTE
void big_value(int8_t& x) {x = static_cast<int8_t>(0xF0U);} void big_value(int8_t& x) {x = static_cast<int8_t>(0xF0U);}
void big_value(uint8_t& x) {x = static_cast<uint8_t>(0xF0U);} void big_value(uint8_t& x) {x = static_cast<uint8_t>(0xF0U);}
void little_value(int8_t& x) {x = static_cast<int8_t>(0xF0U);} void little_value(int8_t& x) {x = static_cast<int8_t>(0xF0U);}
@@ -48,7 +48,7 @@ namespace
void native_value(int16_t& x) {x = static_cast<int16_t>(0xF102U);} void native_value(int16_t& x) {x = static_cast<int16_t>(0xF102U);}
void native_value(uint16_t& x) {x = static_cast<uint16_t>(0xF102U);} void native_value(uint16_t& x) {x = static_cast<uint16_t>(0xF102U);}
# ifdef BOOST_BIG_ENDIAN # if BOOST_ENDIAN_BIG_BYTE
void big_value(int16_t& x) {x = static_cast<int16_t>(0xF102U);} void big_value(int16_t& x) {x = static_cast<int16_t>(0xF102U);}
void big_value(uint16_t& x) {x = static_cast<uint16_t>(0xF102U);} void big_value(uint16_t& x) {x = static_cast<uint16_t>(0xF102U);}
void little_value(int16_t& x) {x = static_cast<int16_t>(0x02F1U);} void little_value(int16_t& x) {x = static_cast<int16_t>(0x02F1U);}
@@ -62,7 +62,7 @@ namespace
void native_value(int32_t& x) {x = static_cast<int32_t>(0xF1E21304UL);} void native_value(int32_t& x) {x = static_cast<int32_t>(0xF1E21304UL);}
void native_value(uint32_t& x) {x = static_cast<uint32_t>(0xF1E21304UL);} void native_value(uint32_t& x) {x = static_cast<uint32_t>(0xF1E21304UL);}
# ifdef BOOST_BIG_ENDIAN # if BOOST_ENDIAN_BIG_BYTE
void big_value(int32_t& x) {x = static_cast<int32_t>(0xF1E21304UL);} void big_value(int32_t& x) {x = static_cast<int32_t>(0xF1E21304UL);}
void big_value(uint32_t& x) {x = static_cast<uint32_t>(0xF1E21304UL);} void big_value(uint32_t& x) {x = static_cast<uint32_t>(0xF1E21304UL);}
void little_value(int32_t& x) {x = static_cast<int32_t>(0x0413E2F1UL);} void little_value(int32_t& x) {x = static_cast<int32_t>(0x0413E2F1UL);}
@@ -76,7 +76,7 @@ namespace
void native_value(int64_t& x) {x = static_cast<int64_t>(0xF1E2D3C444231201ULL);} void native_value(int64_t& x) {x = static_cast<int64_t>(0xF1E2D3C444231201ULL);}
void native_value(uint64_t& x) {x = static_cast<uint64_t>(0xF1E2D3C444231201ULL);} void native_value(uint64_t& x) {x = static_cast<uint64_t>(0xF1E2D3C444231201ULL);}
# ifdef BOOST_BIG_ENDIAN # if BOOST_ENDIAN_BIG_BYTE
void big_value(int64_t& x) {x = static_cast<int64_t>(0xF1E2D3C444231201ULL);} void big_value(int64_t& x) {x = static_cast<int64_t>(0xF1E2D3C444231201ULL);}
void big_value(uint64_t& x) {x = static_cast<uint64_t>(0xF1E2D3C444231201ULL);} void big_value(uint64_t& x) {x = static_cast<uint64_t>(0xF1E2D3C444231201ULL);}
void little_value(int64_t& x) {x = static_cast<int64_t>(0x01122344C4D3E2F1ULL);} void little_value(int64_t& x) {x = static_cast<int64_t>(0x01122344C4D3E2F1ULL);}
@@ -100,7 +100,7 @@ namespace
// validate the values used by the tests below // validate the values used by the tests below
# ifdef BOOST_BIG_ENDIAN # if BOOST_ENDIAN_BIG_BYTE
BOOST_TEST_EQ(native, big); BOOST_TEST_EQ(native, big);
BOOST_TEST_EQ(be::detail::std_endian_reverse(native), little); BOOST_TEST_EQ(be::detail::std_endian_reverse(native), little);
# else # else

View File

@@ -102,7 +102,7 @@ namespace
template <class Endian> template <class Endian>
inline void verify_native_representation( int line ) inline void verify_native_representation( int line )
{ {
# ifdef BOOST_BIG_ENDIAN # if BOOST_ENDIAN_BIG_BYTE
verify_representation<Endian>( true, line ); verify_representation<Endian>( true, line );
# else # else
verify_representation<Endian>( false, line ); verify_representation<Endian>( false, line );
@@ -124,8 +124,8 @@ namespace
if ( memcmp( v.c, "\x8\7\6\5\4\3\2\1", 8) == 0 ) if ( memcmp( v.c, "\x8\7\6\5\4\3\2\1", 8) == 0 )
{ {
cout << "This machine is little-endian.\n"; cout << "This machine is little-endian.\n";
# ifndef BOOST_LITTLE_ENDIAN # if !BOOST_ENDIAN_LITTLE_BYTE
cout << "yet boost/detail/endian.hpp does not define BOOST_LITTLE_ENDIAN.\n" cout << "yet boost/predef/other/endian.h does not define BOOST_ENDIAN_LITTLE_BYTE.\n"
"The Boost Endian library must be revised to work correctly on this system.\n" "The Boost Endian library must be revised to work correctly on this system.\n"
"Please report this problem to the Boost mailing list.\n"; "Please report this problem to the Boost mailing list.\n";
exit(1); exit(1);
@@ -134,8 +134,8 @@ namespace
else if ( memcmp( v.c, "\1\2\3\4\5\6\7\x8", 8) == 0 ) else if ( memcmp( v.c, "\1\2\3\4\5\6\7\x8", 8) == 0 )
{ {
cout << "This machine is big-endian.\n"; cout << "This machine is big-endian.\n";
# ifndef BOOST_BIG_ENDIAN # if !BOOST_ENDIAN_BIG_BYTE
cout << "yet boost/detail/endian.hpp does not define BOOST_BIG_ENDIAN.\n" cout << "yet boost/predef/other/endian.h does not define BOOST_ENDIAN_BIG_BYTE.\n"
"The Boost Endian library must be revised to work correctly on this system.\n" "The Boost Endian library must be revised to work correctly on this system.\n"
"Please report this problem to the Boost mailing list.\n"; "Please report this problem to the Boost mailing list.\n";
exit(1); exit(1);