diff --git a/doc/conversion.html b/doc/conversion.html index 2864883..1dda49e 100644 --- a/doc/conversion.html +++ b/doc/conversion.html @@ -129,7 +129,8 @@ provided.
The only supported types are four byte float
and eight byte
double
. Even after endianness has been accounted for, floating
point values will not be portable between systems that use different floating
-point formats.
-@@ -367,7 +368,7 @@ convert(x, some_order, order::native); // convert to native byte order if needeOnly 16-bit, 32-bit, and 64-bit integers are supported. No tests have been -performed on machines that do not use two's complement arithmetic.
+Only 16-bit, 32-bit, and 64-bit integers are supported. Tests have been +performed on machines that use two's complement arithmetic.
Recent compilers, including GCC, Clang, and Microsoft, supply intrinsic built-in support for byte swapping. Such support is automatically detected and used since it results in smaller and much faster generated code for release builds.
Defining BOOST_ENDIAN_NO_INTRINSICS will suppress use of the intrinsics. Please try defining it if you get compiler errors, such as header byteswap.h not being found.
The macro BOOST_ENDIAN_INTRINSIC_MSG is defined as either "no byte swap intrinsics"
or a string describing the particular set of intrinsics being used.
Tomas Puverle was instrumental in identifying and articulating the need to support endian conversion as separate from endian integer types. Phil Endecott suggested the form of the value returning signatures. Vicente Botet and other reviewers suggested supporting floating point types and user defined types. General reverse template implementation approach using std::reverse suggested by Mathias Gaunard. Portable implementation approach for 16, 32, and 64-bit integers suggested by tymofey, with avoidance of undefined behavior as suggested by Giovanni Piero Deretta, and a further refinement suggested by Pyry Jahkola. Intrinsic builtins implementation approach for 16, 32, and 64-bit integers suggested by several reviewers, and by David Stone, who provided his Boost licensed macro implementation that became the starting point for boost/endian/detail/intrinsic.hpp.
Last revised: 19 May, 2013
+Last revised: 20 May, 2013
© Copyright Beman Dawes, 2011
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 f2ffe06..4172d1b 100644 --- a/doc/index.html +++ b/doc/index.html @@ -26,7 +26,7 @@Boost.Endian provides facilities to manipulate the byte ordering of integers.
+Boost.Endian provides two facilities to manipulate the byte ordering of integers.
-int16_t i = 0x0102; -FILE * file = fopen("test", "wb"); // MUST BE BINARY +FILE * file = fopen("test.bin", "wb"); // MUST BE BINARY fwrite(&i, sizeof(int16_t), 1, file); fclose(file);
On an Apple, Linux, or Windows computer with an Intel CPU, a hex dump -of the "test" output file produces:
+On OS X, Linux, or Windows systems with an Intel CPU, a hex dump +of the "test.bin" output file produces:
-
0201
On an Apple or other computer with a PowerPC CPU, or an Oracle/Sun Solaris computer with a SPARC CPU, a hex dump of the "test" +
On OS X systems with a PowerPC CPU, or Solaris systems with a SPARC CPU, a hex dump of the "test.bin" output file produces:
@@ -111,9 +102,10 @@ at different ends.
0102
See the Wikipedia's Endianness article for an extensive discussion of endianness.
-Except for reading an occasional core dump, most programmers can ignore -endianness. But when exchanging binary integers with other computer systems, whether by -file transfers or over a network, programmers have to deal with endianness.
+Except for reading a core dump on little-endian systems, most programmers can +ignore endianness. But when exchanging binary integers and binary floating point +values between computer systems with differing endianness, whether by physical file transfer or over a network, programmers have to deal with endianness +in their code.
Introduction to the Boost.Endian library
The Boost.Endian library provides two facilities for dealing with endianness.
@@ -185,28 +177,47 @@ application. +Overall FAQ
+Why bother with endianness? Does endianness have any uses outside of +portable binary file or network I/O formats?
+++Binary data portability is the primary use case, and that implies I/O.
+Using the 3, 5, 6, and 7 byte integer types to save internal or external +memory space is a minor secondary use case.
+Why bother with binary I/O? Why not just use C++ Standard Library stream +inserters and extractors?
+++Binary arithmetic data is smaller and therefore I/O is faster and file sizes +are smaller. Transfer between systems is less expensive. Standard interchange +formats often specify binary arithmetic data.
+Furthermore, binary arithmetic data is of fixed size, and so fixed-size disk +records are possible without padding, easing sorting and allowing direct access. +Disadvantages, such as the inability to use text utilities on the resulting +files, limit usefulness to applications where the binary I/O advantages are +paramount.
+Acknowledgements
Comments and suggestions were received from -Benaka Moorthi, +Adder, Benaka Moorthi, Christopher Kohlhoff, -Cliff Green, -Gennaro Proto, -Giovanni Piero Deretta, dizzy, Jeff Flinn, -John Maddock, +Cliff Green,Daniel James, Gennaro Proto, +Giovanni Piero Deretta, Gordon Woodhull, dizzy, Hartmut Kaiser, Jeff Flinn, +John Filo, John Maddock, Kim Barrett, Marsh Ray, -Martin Bonner, -Matias Capeletto, -Neil Mayhew, Phil Endecott, Rene Rivera, +Martin Bonner, Mathias Gaunard, Matias Capeletto, +Neil Mayhew, Paul Bristow, Phil Endecott, Pyry Jahkola, Rene Rivera, Robert Stewart, Roland Schwarz, Scott McMurray, Sebastian Redl, -Tomas Puverle, Vincente Botet, and -Yuval Ronen.
+Tim Blechmann, Tim Moore, tymofey, Tomas Puverle, Vincente Botet, Yuval Ronen +and Vitaly Budovski,.
Last revised: 20 May, 2013
-© Copyright Beman Dawes, 2011
+© 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/types.html b/doc/types.html index 3ea0f74..893d5e9 100644 --- a/doc/types.html +++ b/doc/types.html @@ -53,7 +53,7 @@ Design
Experience
Motivating use cases
- C++0x
+ C++11
Compilation
Acknowledgements @@ -178,9 +178,9 @@ because it has constructors, private data members, and a base class. This means that common use cases are relying on unspecified behavior in that the C++ Standard does not guarantee memory layout for non-POD types. This has not been a problem in practice since all known C++ compilers do layout memory as if-endian
were a POD type. In C++0x, it will be possible to specify the +endian were a POD type. In C++11, it will be possible to specify the default constructor as trivial, and private data members and base classes will -no longer disqualify a type from being a POD. Thus under C++0x,endian
+no longer disqualify a type from being a POD. Thus under C++11,endian
will no longer be relying on unspecified behavior.Feature set
@@ -325,7 +325,7 @@ usual operations on integers are supplied. public: typedef T value_type; - // if BOOST_ENDIAN_FORCE_PODNESS is defined && C++0x POD's are not + // if BOOST_ENDIAN_FORCE_PODNESS is defined && C++11 POD's are not // available then these two constructors will not be present endian() = default; // = default replaced by {} on C++03 explicit endian(T v); @@ -477,7 +477,7 @@ alignment, so may be used to save memory in applications not related to I/O. compared to arithmetic operations on native integer types. However, these types are usually be faster, and sometimes much faster, for I/O compared to stream inserters and extractors, or to serialization. -
Are endian types POD's? Yes for C++0x. No for C++03, although several +
Are endian types POD's? Yes for C++11. No for C++03, although several macros are available to force PODness in all cases.
What are the implications endian integer types not being POD's with C++03 compilers? They @@ -544,8 +544,8 @@ range of computer architectures and applications.
library: reading TrueType font files from disk and processing the contents. The data format has fixed endianness (big) and has unaligned values in various places. Using Boost.Endian simplifies and cleans the code wonderfully." -C++0x
-The availability of the C++0x +
C++11
+The availability of the C++11 Defaulted Functions feature is detected automatically, and will be used if present to ensure that objects of
class endian
are trivial, and @@ -557,15 +557,15 @@ any Boost object libraries.
- BOOST_ENDIAN_NO_CTORS causes
class endian
to have no constructors. The intended use is for compiling user code that must be - portable between compilers regardless of C++0x + portable between compilers regardless of C++11 Defaulted Functions support. Use of constructors will always fail,
- BOOST_ENDIAN_FORCE_PODNESS causes BOOST_ENDIAN_NO_CTORS to be defined if - the compiler does not support C++0x + the compiler does not support C++11 Defaulted Functions. This is ensures that , and so can be used in unions. - In C++0x,
class endian
objects are POD's even though they have + In C++11,class endian
objects are POD's even though they have constructors.Acknowledgements
@@ -577,7 +577,7 @@ sign partial specialization to correctly extend the sign when cover integer size differs from endian representation size.
Last revised: -05 September, 2011
+20 May, 2013© Copyright Beman Dawes, 2006-2009
Distributed under the Boost Software License, Version 1.0. See www.boost.org/ LICENSE_1_0.txt