diff --git a/doc/arithmetic.html b/doc/arithmetic.html index 1066d14..7c091c9 100644 --- a/doc/arithmetic.html +++ b/doc/arithmetic.html @@ -320,23 +320,19 @@ example:
have identical layout on all platforms, so they never actually reverse endianness. They are provided to enable generic code, and to improve code readability and searchability.endian
_arithmetic
An endian is an integer byte-holder with user-specified
+ An endian_integer
is an integer byte-holder with user-specified
endianness, value type, size, and alignment. The
-usual operations on integers are supplied.
namespace boost +#include <boost/endian/conversion.hpp> +#include <boost/endian/buffers.hpp> + +namespace boost { namespace endian { // C++11 features emulated if not available - enum class order - { - big, // big-endian - little, // little-endian - native = implementation-defined // same as order::big or order::little - }; - enum class align {no, yes}; template <order Order, class T, std::size_t n_bits, @@ -633,7 +629,7 @@ sign partial specialization to correctly extend the sign when cover integer size differs from endian representation size.
Last revised: -25 March, 2015
+14 October, 2015© Copyright Beman Dawes, 2006-2009, 2013
Distributed under the Boost Software License, Version 1.0. See www.boost.org/ LICENSE_1_0.txt
diff --git a/doc/buffers.html b/doc/buffers.html index 85aae22..8968459 100644 --- a/doc/buffers.html +++ b/doc/buffers.html @@ -303,23 +303,17 @@ example: have identical layout on all platforms, so they never actually reverse endianness. They are provided to enable generic code, and to improve code readability and searchability.Class template
-endian
_buffer
An
+endian_buffer
is an integer byte-holder with user-specified -endianness, value type, size, and alignment. The -usual operations on integers are supplied.An
endian_buffer
is a byte-holder for arithmetic types with user-specified +endianness, value type, size, and alignment.Synopsis
-namespace boost +#include <boost/endian/conversion.hpp + +namespace boost { namespace endian { // C++11 features emulated if not available - enum class order - { - big, // big-endian - little, // little-endian - native = implementation-defined // same as order::big or order::little - }; - enum class align {no, yes}; template <order Order, class T, std::size_t Nbits, @@ -550,14 +544,6 @@ may be faster (as much as 10 to 20 times faster) if the endianness and alignment the type matches the endianness and alignment requirements of the machine. The code, however, is likely to be somewhat less portable than with the unaligned types. -Why provide the arithmetic operations? Providing a full set of operations reduces program -clutter and makes code both easier to write and to read. Consider -incrementing a variable in a record. It is very convenient to write:
-++record.foo;-Rather than:
-int temp(record.foo); - ++temp; - record.foo = temp;Design considerations for Boost.Endian buffers
Last revised: -25 March, 2015
+14 October, 2015© Copyright Beman Dawes, 2006-2009, 2013
Distributed under the Boost Software License, Version 1.0. See www.boost.org/ LICENSE_1_0.txt
diff --git a/doc/conversion.html b/doc/conversion.html index 234537b..0e86598 100644 --- a/doc/conversion.html +++ b/doc/conversion.html @@ -1,4 +1,4 @@ - + @@ -68,9 +68,27 @@ ordering. User defined types are also supported.Functions are implemented inline
if appropriate.
For C++03 compilers, noexcept
is
-elided .
+elided.
Boost scoped enum emulation is used so that the library still works for compilers that do not support scoped enums.
Endianness refers to the ordering of bytes within internal or +external integers and other arithmetic data. Most-significant byte first is +called big endian ordering. Least-significant byte first is called +little endian ordering. Other orderings are possible and some CPU +architectures support both big and little ordering.
+++[Note: The names are derived from + +Jonathan Swift's satirical novel + +Gulliver’s Travels, where rival kingdoms opened their soft-boiled eggs +at different ends. Wikipedia has an extensive description of +Endianness. —end note]
+
The standard integral types (C++std 3.9.1) except bool
+are collectively called the endian types.
<boost/endian/conversion.hpp>
SynopsisThe implementation is required to define the enum class order
-constant native
as
-big
on big endian platforms and little
on little
-endian platforms.
The standard integral types (C++std 3.9.1) except bool
,
-are collectively called the endian types.
The values of order::little
and order::big
shall
+not be equal to one another.
The value of order::native
+shall be:
order::big
if the execution environment is big
+ endian, otherwiseorder::little
if the execution environment is little
+ endian, otherwiseorder::little
and order::big
.The template definitions in the boost/endian/conversion.hpp
+
The template definitions in the boost/endian/conversion.hpp
header refer to various named requirements whose details are set out in the
tables in this subsection. In these tables, T
is an object or
reference type to be supplied by a C++ program instantiating a template; x
@@ -232,7 +254,7 @@ uint16_t endian_reverse(uint16_t x) noexcept;
uint32_t endian_reverse(uint32_t x) noexcept;
uint64_t endian_reverse(uint64_t x) noexcept;
--Returns:
x
, with the order of its +Returns:
x
, with the order of its constituent bytes reversed.Remarks: The type of
x
meets theEndianReversible
requirements.[Note: The Boost.Endian library does not provide overloads for the C++ standard library @@ -373,7 +395,8 @@ that became the starting point for
boost/endian/detail/intrinsic.hppint8_t endian_reverse()
and templatedendian_reverse_inplace()
implementations.
-Last revised: 21 July, 2015
+Last revised: +14 October, 2015
© Copyright Beman Dawes, 2011, 2013
Distributed under the Boost Software License, Version 1.0. See www.boost.org/ LICENSE_1_0.txt
diff --git a/doc/index.html b/doc/index.html index 8d587b0..4c66d48 100644 --- a/doc/index.html +++ b/doc/index.html @@ -433,11 +433,14 @@ CPU's. The Wikipedia article gives more pros and cons.
Why are only big, little, and native endianness supported?
+Why are only big and little native endianness supported?
These are the only endian schemes that have any practical value today. PDP-11 and the other middle endian approaches are interesting historical curiosities -but have no relevance to today's C++ developers.
+but have no relevance to today's C++ developers. The +specification for native +ordering is carefully crafted to allow implementations to support other +orderings, thanks to Howard Hinnant.
Why do both the buffer and arithmetic types exist?
@@ -596,7 +599,7 @@ and subsequent replies.Comments and suggestions were received from Adder, Benaka Moorthi, Christopher Kohlhoff, Cliff Green, Daniel James, Dave Handley, Gennaro Proto, Giovanni Piero -Deretta, Gordon Woodhull, dizzy, Hartmut Kaiser, Jason Newton, Jeff Flinn, Jeremy Maitin-Shepard, John Filo, John +Deretta, Gordon Woodhull, dizzy, Hartmut Kaiser, Howard Hinnant, Jason Newton, Jeff Flinn, Jeremy Maitin-Shepard, John Filo, John Maddock, Kim Barrett, Marsh Ray, Martin Bonner, Mathias Gaunard, Matias Capeletto, Neil Mayhew, Nevin Liber, Olaf van der Spek, Paul Bristow, Peter Dimov, Pierre Talbot, Phil Endecott, @@ -606,7 +609,7 @@ Blechmann, Tim Moore, tymofey, Tomas Puverle, Vincente Botet, Yuval Ronen and Vitaly Budovsk. Apologies if anyone has been missed.
Last revised: -10 April, 2015
+14 October, 2015© Copyright Beman Dawes, 2011, 2013
Distributed under the Boost Software License, Version 1.0. See www.boost.org/ LICENSE_1_0.txt
diff --git a/include/boost/endian/conversion.hpp b/include/boost/endian/conversion.hpp index 1e502d5..7c145d9 100644 --- a/include/boost/endian/conversion.hpp +++ b/include/boost/endian/conversion.hpp @@ -23,7 +23,6 @@ namespace boost { namespace endian { -#ifndef BOOST_ENDIAN_ORDER_ENUM_DEFINED BOOST_SCOPED_ENUM_START(order) { big, little, @@ -33,8 +32,6 @@ namespace endian native = little # endif }; BOOST_SCOPED_ENUM_END -# define BOOST_ENDIAN_ORDER_ENUM_DEFINED -#endif //--------------------------------------------------------------------------------------// // //