Remove use of Predef in arithmetic.hpp, buffers.hpp, conversion.hpp

This commit is contained in:
Peter Dimov
2020-01-04 21:18:35 +02:00
parent 3de20eb340
commit b8139ad7a1
3 changed files with 41 additions and 180 deletions

View File

@ -29,7 +29,6 @@
#include <boost/endian/buffers.hpp>
#include <boost/core/scoped_enum.hpp>
#include <boost/predef/other/endian.h>
#include <boost/static_assert.hpp>
#include <boost/cstdint.hpp>
#include <boost/config.hpp>
@ -146,47 +145,25 @@ namespace endian
typedef endian_arithmetic<order::little, uint_least64_t, 56> little_uint56_t;
typedef endian_arithmetic<order::little, uint_least64_t, 64> little_uint64_t;
# if BOOST_ENDIAN_BIG_BYTE
// native endian signed integer unaligned types
typedef big_int8_t native_int8_t;
typedef big_int16_t native_int16_t;
typedef big_int24_t native_int24_t;
typedef big_int32_t native_int32_t;
typedef big_int40_t native_int40_t;
typedef big_int48_t native_int48_t;
typedef big_int56_t native_int56_t;
typedef big_int64_t native_int64_t;
typedef endian_arithmetic<order::native, int_least8_t, 8> native_int8_t;
typedef endian_arithmetic<order::native, int_least16_t, 16> native_int16_t;
typedef endian_arithmetic<order::native, int_least32_t, 24> native_int24_t;
typedef endian_arithmetic<order::native, int_least32_t, 32> native_int32_t;
typedef endian_arithmetic<order::native, int_least64_t, 40> native_int40_t;
typedef endian_arithmetic<order::native, int_least64_t, 48> native_int48_t;
typedef endian_arithmetic<order::native, int_least64_t, 56> native_int56_t;
typedef endian_arithmetic<order::native, int_least64_t, 64> native_int64_t;
// native endian unsigned integer unaligned types
typedef big_uint8_t native_uint8_t;
typedef big_uint16_t native_uint16_t;
typedef big_uint24_t native_uint24_t;
typedef big_uint32_t native_uint32_t;
typedef big_uint40_t native_uint40_t;
typedef big_uint48_t native_uint48_t;
typedef big_uint56_t native_uint56_t;
typedef big_uint64_t native_uint64_t;
# else
// native endian signed integer unaligned types
typedef little_int8_t native_int8_t;
typedef little_int16_t native_int16_t;
typedef little_int24_t native_int24_t;
typedef little_int32_t native_int32_t;
typedef little_int40_t native_int40_t;
typedef little_int48_t native_int48_t;
typedef little_int56_t native_int56_t;
typedef little_int64_t native_int64_t;
// native endian unsigned integer unaligned types
typedef little_uint8_t native_uint8_t;
typedef little_uint16_t native_uint16_t;
typedef little_uint24_t native_uint24_t;
typedef little_uint32_t native_uint32_t;
typedef little_uint40_t native_uint40_t;
typedef little_uint48_t native_uint48_t;
typedef little_uint56_t native_uint56_t;
typedef little_uint64_t native_uint64_t;
# endif
typedef endian_arithmetic<order::native, uint_least8_t, 8> native_uint8_t;
typedef endian_arithmetic<order::native, uint_least16_t, 16> native_uint16_t;
typedef endian_arithmetic<order::native, uint_least32_t, 24> native_uint24_t;
typedef endian_arithmetic<order::native, uint_least32_t, 32> native_uint32_t;
typedef endian_arithmetic<order::native, uint_least64_t, 40> native_uint40_t;
typedef endian_arithmetic<order::native, uint_least64_t, 48> native_uint48_t;
typedef endian_arithmetic<order::native, uint_least64_t, 56> native_uint56_t;
typedef endian_arithmetic<order::native, uint_least64_t, 64> native_uint64_t;
// unaligned floating point types
typedef endian_arithmetic<order::big, float, 32, align::no> big_float32_t;

View File

@ -30,7 +30,6 @@
#include <boost/endian/detail/endian_store.hpp>
#include <boost/endian/detail/endian_load.hpp>
#include <boost/core/scoped_enum.hpp>
#include <boost/predef/other/endian.h>
#include <boost/static_assert.hpp>
#include <boost/cstdint.hpp>
#include <boost/config.hpp>
@ -149,47 +148,25 @@ namespace endian
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;
# if BOOST_ENDIAN_BIG_BYTE
// unaligned native endian signed integer buffers
typedef big_int8_buf_t native_int8_buf_t;
typedef big_int16_buf_t native_int16_buf_t;
typedef big_int24_buf_t native_int24_buf_t;
typedef big_int32_buf_t native_int32_buf_t;
typedef big_int40_buf_t native_int40_buf_t;
typedef big_int48_buf_t native_int48_buf_t;
typedef big_int56_buf_t native_int56_buf_t;
typedef big_int64_buf_t native_int64_buf_t;
typedef endian_buffer<order::native, int_least8_t, 8> native_int8_buf_t;
typedef endian_buffer<order::native, int_least16_t, 16> native_int16_buf_t;
typedef endian_buffer<order::native, int_least32_t, 24> native_int24_buf_t;
typedef endian_buffer<order::native, int_least32_t, 32> native_int32_buf_t;
typedef endian_buffer<order::native, int_least64_t, 40> native_int40_buf_t;
typedef endian_buffer<order::native, int_least64_t, 48> native_int48_buf_t;
typedef endian_buffer<order::native, int_least64_t, 56> native_int56_buf_t;
typedef endian_buffer<order::native, int_least64_t, 64> native_int64_buf_t;
// unaligned native endian unsigned integer buffers
typedef big_uint8_buf_t native_uint8_buf_t;
typedef big_uint16_buf_t native_uint16_buf_t;
typedef big_uint24_buf_t native_uint24_buf_t;
typedef big_uint32_buf_t native_uint32_buf_t;
typedef big_uint40_buf_t native_uint40_buf_t;
typedef big_uint48_buf_t native_uint48_buf_t;
typedef big_uint56_buf_t native_uint56_buf_t;
typedef big_uint64_buf_t native_uint64_buf_t;
# else
// unaligned native endian signed integer buffers
typedef little_int8_buf_t native_int8_buf_t;
typedef little_int16_buf_t native_int16_buf_t;
typedef little_int24_buf_t native_int24_buf_t;
typedef little_int32_buf_t native_int32_buf_t;
typedef little_int40_buf_t native_int40_buf_t;
typedef little_int48_buf_t native_int48_buf_t;
typedef little_int56_buf_t native_int56_buf_t;
typedef little_int64_buf_t native_int64_buf_t;
// unaligned native endian unsigned integer buffers
typedef little_uint8_buf_t native_uint8_buf_t;
typedef little_uint16_buf_t native_uint16_buf_t;
typedef little_uint24_buf_t native_uint24_buf_t;
typedef little_uint32_buf_t native_uint32_buf_t;
typedef little_uint40_buf_t native_uint40_buf_t;
typedef little_uint48_buf_t native_uint48_buf_t;
typedef little_uint56_buf_t native_uint56_buf_t;
typedef little_uint64_buf_t native_uint64_buf_t;
# endif
typedef endian_buffer<order::native, uint_least8_t, 8> native_uint8_buf_t;
typedef endian_buffer<order::native, uint_least16_t, 16> native_uint16_buf_t;
typedef endian_buffer<order::native, uint_least32_t, 24> native_uint24_buf_t;
typedef endian_buffer<order::native, uint_least32_t, 32> native_uint32_buf_t;
typedef endian_buffer<order::native, uint_least64_t, 40> native_uint40_buf_t;
typedef endian_buffer<order::native, uint_least64_t, 48> native_uint48_buf_t;
typedef endian_buffer<order::native, uint_least64_t, 56> native_uint56_buf_t;
typedef endian_buffer<order::native, uint_least64_t, 64> native_uint64_buf_t;
// unaligned floating point buffers
typedef endian_buffer<order::big, float, 32, align::no> big_float32_buf_t;

View File

@ -16,7 +16,6 @@
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/predef/other/endian.h>
#include <boost/static_assert.hpp>
#include <boost/cstdint.hpp>
#include <boost/config.hpp>
@ -156,65 +155,25 @@ template<class T> struct is_endian_reversible: boost::integral_constant<bool,
template <class EndianReversible>
inline BOOST_CONSTEXPR EndianReversible big_to_native( EndianReversible x ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( detail::is_endian_reversible<EndianReversible>::value );
#if BOOST_ENDIAN_BIG_BYTE
return x;
#else
return endian_reverse(x);
#endif
return boost::endian::conditional_reverse<order::big, order::native>( x );
}
template <class EndianReversible>
inline BOOST_CONSTEXPR EndianReversible native_to_big( EndianReversible x ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( detail::is_endian_reversible<EndianReversible>::value );
#if BOOST_ENDIAN_BIG_BYTE
return x;
#else
return endian_reverse(x);
#endif
return boost::endian::conditional_reverse<order::native, order::big>( x );
}
template <class EndianReversible>
inline BOOST_CONSTEXPR EndianReversible little_to_native( EndianReversible x ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( detail::is_endian_reversible<EndianReversible>::value );
#if BOOST_ENDIAN_LITTLE_BYTE
return x;
#else
return endian_reverse(x);
#endif
return boost::endian::conditional_reverse<order::little, order::native>( x );
}
template <class EndianReversible>
inline BOOST_CONSTEXPR EndianReversible native_to_little( EndianReversible x ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( detail::is_endian_reversible<EndianReversible>::value );
#if BOOST_ENDIAN_LITTLE_BYTE
return x;
#else
return endian_reverse(x);
#endif
return boost::endian::conditional_reverse<order::native, order::little>( x );
}
namespace detail
@ -265,82 +224,30 @@ template<class T> struct is_endian_reversible_inplace: boost::integral_constant<
} // namespace detail
#if BOOST_ENDIAN_BIG_BYTE
template <class EndianReversibleInplace>
inline void big_to_native_inplace( EndianReversibleInplace& ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( detail::is_endian_reversible_inplace<EndianReversibleInplace>::value );
}
#else
template <class EndianReversibleInplace>
inline void big_to_native_inplace( EndianReversibleInplace& x ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( detail::is_endian_reversible_inplace<EndianReversibleInplace>::value );
endian_reverse_inplace( x );
boost::endian::conditional_reverse_inplace<order::big, order::native>( x );
}
#endif
#if BOOST_ENDIAN_BIG_BYTE
template <class EndianReversibleInplace>
inline void native_to_big_inplace( EndianReversibleInplace& ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( detail::is_endian_reversible_inplace<EndianReversibleInplace>::value );
}
#else
template <class EndianReversibleInplace>
inline void native_to_big_inplace( EndianReversibleInplace& x ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( detail::is_endian_reversible_inplace<EndianReversibleInplace>::value );
endian_reverse_inplace( x );
boost::endian::conditional_reverse_inplace<order::native, order::big>( x );
}
#endif
#if BOOST_ENDIAN_LITTLE_BYTE
template <class EndianReversibleInplace>
inline void little_to_native_inplace( EndianReversibleInplace& ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( detail::is_endian_reversible_inplace<EndianReversibleInplace>::value );
}
#else
template <class EndianReversibleInplace>
inline void little_to_native_inplace( EndianReversibleInplace& x ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( detail::is_endian_reversible_inplace<EndianReversibleInplace>::value );
endian_reverse_inplace( x );
boost::endian::conditional_reverse_inplace<order::little, order::native>( x );
}
#endif
#if BOOST_ENDIAN_LITTLE_BYTE
template <class EndianReversibleInplace>
inline void native_to_little_inplace( EndianReversibleInplace& ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( detail::is_endian_reversible_inplace<EndianReversibleInplace>::value );
}
#else
template <class EndianReversibleInplace>
inline void native_to_little_inplace( EndianReversibleInplace& x ) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT( detail::is_endian_reversible_inplace<EndianReversibleInplace>::value );
endian_reverse_inplace( x );
boost::endian::conditional_reverse_inplace<order::native, order::little>( x );
}
#endif
namespace detail
{