forked from boostorg/endian
Add support for deprecated names from pre-review releases.
This commit is contained in:
1 parent
e9ae69f3d0
commit
adee2fe513
9 files changed
+412
-44
No files matched your search
@@ -44,7 +44,7 @@
|
||||
#include <boost/type_traits/is_signed.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/detail/scoped_enum_emulation.hpp>
|
||||
#include <boost/core/scoped_enum.hpp>
|
||||
#include <iosfwd>
|
||||
#include <climits>
|
||||
|
||||
@@ -75,19 +75,6 @@ namespace boost
|
||||
namespace endian
|
||||
{
|
||||
|
||||
#ifndef BOOST_ENDIAN_ORDER_ENUM_DEFINED
|
||||
BOOST_SCOPED_ENUM_START(order)
|
||||
{
|
||||
big, little,
|
||||
# ifdef BOOST_BIG_ENDIAN
|
||||
native = big
|
||||
# else
|
||||
native = little
|
||||
# endif
|
||||
}; BOOST_SCOPED_ENUM_END
|
||||
# define BOOST_ENDIAN_ORDER_ENUM_DEFINED
|
||||
#endif
|
||||
|
||||
template <BOOST_SCOPED_ENUM(order) Order, class T, std::size_t n_bits,
|
||||
BOOST_SCOPED_ENUM(align) A = align::no>
|
||||
class endian_arithmetic;
|
||||
@@ -224,16 +211,100 @@ namespace endian
|
||||
typedef little_float32_t native_float32_t;
|
||||
typedef little_float64_t native_float64_t;
|
||||
# endif
|
||||
} // namespace boost
|
||||
} // namespace endian
|
||||
|
||||
# ifdef BOOST_ENDIAN_DEPRECATED_NAMES
|
||||
|
||||
typedef order endianness;
|
||||
typedef align alignment;
|
||||
|
||||
# ifndef BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
template <BOOST_SCOPED_ENUM(order) Order, class T, std::size_t n_bits,
|
||||
BOOST_SCOPED_ENUM(align) Align = align::no>
|
||||
using endian = endian_arithmetic<Order, T, n_bits, Align>;
|
||||
# endif
|
||||
|
||||
// unaligned big endian signed integer types
|
||||
typedef endian_arithmetic< order::big, int_least8_t, 8 > big8_t;
|
||||
typedef endian_arithmetic< order::big, int_least16_t, 16 > big16_t;
|
||||
typedef endian_arithmetic< order::big, int_least32_t, 24 > big24_t;
|
||||
typedef endian_arithmetic< order::big, int_least32_t, 32 > big32_t;
|
||||
typedef endian_arithmetic< order::big, int_least64_t, 40 > big40_t;
|
||||
typedef endian_arithmetic< order::big, int_least64_t, 48 > big48_t;
|
||||
typedef endian_arithmetic< order::big, int_least64_t, 56 > big56_t;
|
||||
typedef endian_arithmetic< order::big, int_least64_t, 64 > big64_t;
|
||||
|
||||
// unaligned big endian_arithmetic unsigned integer types
|
||||
typedef endian_arithmetic< order::big, uint_least8_t, 8 > ubig8_t;
|
||||
typedef endian_arithmetic< order::big, uint_least16_t, 16 > ubig16_t;
|
||||
typedef endian_arithmetic< order::big, uint_least32_t, 24 > ubig24_t;
|
||||
typedef endian_arithmetic< order::big, uint_least32_t, 32 > ubig32_t;
|
||||
typedef endian_arithmetic< order::big, uint_least64_t, 40 > ubig40_t;
|
||||
typedef endian_arithmetic< order::big, uint_least64_t, 48 > ubig48_t;
|
||||
typedef endian_arithmetic< order::big, uint_least64_t, 56 > ubig56_t;
|
||||
typedef endian_arithmetic< order::big, uint_least64_t, 64 > ubig64_t;
|
||||
|
||||
// unaligned little endian_arithmetic signed integer types
|
||||
typedef endian_arithmetic< order::little, int_least8_t, 8 > little8_t;
|
||||
typedef endian_arithmetic< order::little, int_least16_t, 16 > little16_t;
|
||||
typedef endian_arithmetic< order::little, int_least32_t, 24 > little24_t;
|
||||
typedef endian_arithmetic< order::little, int_least32_t, 32 > little32_t;
|
||||
typedef endian_arithmetic< order::little, int_least64_t, 40 > little40_t;
|
||||
typedef endian_arithmetic< order::little, int_least64_t, 48 > little48_t;
|
||||
typedef endian_arithmetic< order::little, int_least64_t, 56 > little56_t;
|
||||
typedef endian_arithmetic< order::little, int_least64_t, 64 > little64_t;
|
||||
|
||||
// unaligned little endian_arithmetic unsigned integer types
|
||||
typedef endian_arithmetic< order::little, uint_least8_t, 8 > ulittle8_t;
|
||||
typedef endian_arithmetic< order::little, uint_least16_t, 16 > ulittle16_t;
|
||||
typedef endian_arithmetic< order::little, uint_least32_t, 24 > ulittle24_t;
|
||||
typedef endian_arithmetic< order::little, uint_least32_t, 32 > ulittle32_t;
|
||||
typedef endian_arithmetic< order::little, uint_least64_t, 40 > ulittle40_t;
|
||||
typedef endian_arithmetic< order::little, uint_least64_t, 48 > ulittle48_t;
|
||||
typedef endian_arithmetic< order::little, uint_least64_t, 56 > ulittle56_t;
|
||||
typedef endian_arithmetic< order::little, uint_least64_t, 64 > ulittle64_t;
|
||||
|
||||
// unaligned native endian_arithmetic signed integer types
|
||||
typedef endian_arithmetic< order::native, int_least8_t, 8 > native8_t;
|
||||
typedef endian_arithmetic< order::native, int_least16_t, 16 > native16_t;
|
||||
typedef endian_arithmetic< order::native, int_least32_t, 24 > native24_t;
|
||||
typedef endian_arithmetic< order::native, int_least32_t, 32 > native32_t;
|
||||
typedef endian_arithmetic< order::native, int_least64_t, 40 > native40_t;
|
||||
typedef endian_arithmetic< order::native, int_least64_t, 48 > native48_t;
|
||||
typedef endian_arithmetic< order::native, int_least64_t, 56 > native56_t;
|
||||
typedef endian_arithmetic< order::native, int_least64_t, 64 > native64_t;
|
||||
|
||||
// unaligned native endian_arithmetic unsigned integer types
|
||||
typedef endian_arithmetic< order::native, uint_least8_t, 8 > unative8_t;
|
||||
typedef endian_arithmetic< order::native, uint_least16_t, 16 > unative16_t;
|
||||
typedef endian_arithmetic< order::native, uint_least32_t, 24 > unative24_t;
|
||||
typedef endian_arithmetic< order::native, uint_least32_t, 32 > unative32_t;
|
||||
typedef endian_arithmetic< order::native, uint_least64_t, 40 > unative40_t;
|
||||
typedef endian_arithmetic< order::native, uint_least64_t, 48 > unative48_t;
|
||||
typedef endian_arithmetic< order::native, uint_least64_t, 56 > unative56_t;
|
||||
typedef endian_arithmetic< order::native, uint_least64_t, 64 > unative64_t;
|
||||
|
||||
// aligned native endian_arithmetic typedefs are not provided because
|
||||
// <cstdint> types are superior for this use case
|
||||
|
||||
typedef endian_arithmetic< order::big, int16_t, 16, align::yes > aligned_big16_t;
|
||||
typedef endian_arithmetic< order::big, uint16_t, 16, align::yes > aligned_ubig16_t;
|
||||
typedef endian_arithmetic< order::little, int16_t, 16, align::yes > aligned_little16_t;
|
||||
typedef endian_arithmetic< order::little, uint16_t, 16, align::yes > aligned_ulittle16_t;
|
||||
|
||||
typedef endian_arithmetic< order::big, int32_t, 32, align::yes > aligned_big32_t;
|
||||
typedef endian_arithmetic< order::big, uint32_t, 32, align::yes > aligned_ubig32_t;
|
||||
typedef endian_arithmetic< order::little, int32_t, 32, align::yes > aligned_little32_t;
|
||||
typedef endian_arithmetic< order::little, uint32_t, 32, align::yes > aligned_ulittle32_t;
|
||||
|
||||
typedef endian_arithmetic< order::big, int64_t, 64, align::yes > aligned_big64_t;
|
||||
typedef endian_arithmetic< order::big, uint64_t, 64, align::yes > aligned_ubig64_t;
|
||||
typedef endian_arithmetic< order::little, int64_t, 64, align::yes > aligned_little64_t;
|
||||
typedef endian_arithmetic< order::little, uint64_t, 64, align::yes > aligned_ulittle64_t;
|
||||
|
||||
# endif
|
||||
|
||||
//---------------------------------- end synopsis ------------------------------------//
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace endian
|
||||
{
|
||||
|
||||
// endian class template specializations ---------------------------------------------//
|
||||
|
||||
// Specializations that represent unaligned bytes.
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include <boost/type_traits/is_signed.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/detail/scoped_enum_emulation.hpp>
|
||||
#include <boost/core/scoped_enum.hpp>
|
||||
#include <iosfwd>
|
||||
#include <climits>
|
||||
|
||||
@@ -65,19 +65,12 @@ namespace boost
|
||||
namespace endian
|
||||
{
|
||||
|
||||
#ifndef BOOST_ENDIAN_ORDER_ENUM_DEFINED
|
||||
BOOST_SCOPED_ENUM_START(order)
|
||||
{
|
||||
big, little,
|
||||
# ifdef BOOST_BIG_ENDIAN
|
||||
native = big
|
||||
# else
|
||||
native = little
|
||||
# endif
|
||||
BOOST_SCOPED_ENUM_START(align)
|
||||
{no, yes
|
||||
# ifdef BOOST_ENDIAN_DEPRECATED_NAMES
|
||||
, unaligned = no, aligned = yes
|
||||
# endif
|
||||
}; BOOST_SCOPED_ENUM_END
|
||||
# define BOOST_ENDIAN_ORDER_ENUM_DEFINED
|
||||
#endif
|
||||
BOOST_SCOPED_ENUM_START(align) {no, yes}; BOOST_SCOPED_ENUM_END
|
||||
|
||||
template <BOOST_SCOPED_ENUM(order) Order, class T, std::size_t n_bits,
|
||||
BOOST_SCOPED_ENUM(align) A = align::no>
|
||||
@@ -239,15 +232,8 @@ namespace endian
|
||||
return is;
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
} // namespace endian
|
||||
|
||||
//---------------------------------- end synopsis ------------------------------------//
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace endian
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <boost/predef/detail/endian_compat.h>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/endian/detail/intrinsic.hpp>
|
||||
#include <boost/detail/scoped_enum_emulation.hpp>
|
||||
#include <boost/core/scoped_enum.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstring> // for memcpy
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
// boost/endian/endian.hpp -----------------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 2015
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
// See library home page at http://www.boost.org/libs/endian
|
||||
|
||||
#ifndef BOOST_ENDIAN_ENDIAN_HPP
|
||||
#define BOOST_ENDIAN_ENDIAN_HPP
|
||||
|
||||
#ifndef BOOST_ENDIAN_DEPRECATED_NAMES
|
||||
# error "<boost/endian/endian.hpp> is deprecated. Define BOOST_ENDIAN_DEPRECATED_NAMES to use."
|
||||
#endif
|
||||
|
||||
#include <boost/endian/arithmetic.hpp>
|
||||
|
||||
#endif //BOOST_ENDIAN_ENDIAN_HPP
|
||||
Reference in new issue
Block a user