forked from boostorg/endian
Don another pass through the docs.
This commit is contained in:
@ -65,17 +65,7 @@
|
|||||||
<a href="#Acknowledgements">Acknowledgements</a>
|
<a href="#Acknowledgements">Acknowledgements</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
</table>
|
||||||
<td width="100%" bgcolor="#D7EEFF" align="center">
|
|
||||||
<b><i>Headers</i></b></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="100%" bgcolor="#E8F5FF">
|
|
||||||
<a href="../include/boost/endian/conversion.hpp"><boost/endian/conversion.hpp></a><br>
|
|
||||||
<a href="../include/boost/endian/buffers.hpp"><boost/endian/buffers.hpp></a><br>
|
|
||||||
<a href="../include/boost/endian/arithmetic.hpp"><boost/endian/arithmetic.hpp></a></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<h2><a name="Introduction">Introduction</a></h2>
|
<h2><a name="Introduction">Introduction</a></h2>
|
||||||
<p>Header <a href="arithmetic.html">boost/endian/arithmetic.hpp</a>
|
<p>Header <a href="arithmetic.html">boost/endian/arithmetic.hpp</a>
|
||||||
provides integer and floating point binary types with control over
|
provides integer and floating point binary types with control over
|
||||||
@ -682,7 +672,7 @@ differs from endian representation size. Vicente Botet and other reviewers
|
|||||||
suggested supporting floating point types.</p>
|
suggested supporting floating point types.</p>
|
||||||
<hr>
|
<hr>
|
||||||
<p>Last revised:
|
<p>Last revised:
|
||||||
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->04 January, 2015<!--webbot bot="Timestamp" endspan i-checksum="38892" --></p>
|
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->17 January, 2015<!--webbot bot="Timestamp" endspan i-checksum="38899" --></p>
|
||||||
<p>© Copyright Beman Dawes, 2006-2009, 2013</p>
|
<p>© Copyright Beman Dawes, 2006-2009, 2013</p>
|
||||||
<p>Distributed under the Boost Software License, Version 1.0. See
|
<p>Distributed under the Boost Software License, Version 1.0. See
|
||||||
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/ LICENSE_1_0.txt</a></p>
|
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/ LICENSE_1_0.txt</a></p>
|
||||||
|
@ -54,30 +54,20 @@
|
|||||||
|
|
||||||
<a href="#Synopsis">Synopsis</a><br>
|
<a href="#Synopsis">Synopsis</a><br>
|
||||||
<a href="#Members">Members</a><br>
|
<a href="#Members">Members</a><br>
|
||||||
|
<a href="#Non-member-functions">Non-Members</a><br>
|
||||||
<a href="#FAQ">FAQ</a><br>
|
<a href="#FAQ">FAQ</a><br>
|
||||||
<a href="#Design">Design</a><br>
|
<a href="#Design">Design</a><br>
|
||||||
<a href="#C++0x">C++11</a><br>
|
<a href="#C++0x">C++11</a><br>
|
||||||
<a href="#Compilation">Compilation</a></td>
|
<a href="#Compilation">Compilation</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
</table>
|
||||||
<td width="100%" bgcolor="#D7EEFF" align="center">
|
|
||||||
<b><i>Headers</i></b></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="100%" bgcolor="#E8F5FF">
|
|
||||||
<p dir="ltr">
|
|
||||||
<a href="../include/boost/endian/conversion.hpp"><boost/endian/conversion.hpp></a><br>
|
|
||||||
<a href="../include/boost/endian/buffers.hpp"><boost/endian/buffers.hpp></a><br>
|
|
||||||
<a href="../include/boost/endian/arithmetic.hpp"><boost/endian/arithmetic.hpp></a></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<h2><a name="Introduction">Introduction</a></h2>
|
<h2><a name="Introduction">Introduction</a></h2>
|
||||||
<p>The internal byte order of arithmetic types is traditionally called <b><i>endianness</i></b>. See the
|
<p>The internal byte order of arithmetic types is traditionally called <b><i>endianness</i></b>. See the
|
||||||
<a href="http://en.wikipedia.org/wiki/Endian" name="endianness">Wikipedia</a> for
|
<a href="http://en.wikipedia.org/wiki/Endian" name="endianness">Wikipedia</a> for
|
||||||
a full
|
a full
|
||||||
exploration of <b><i>endianness</i></b>, including definitions of <i><b>big
|
exploration of <b><i>endianness</i></b>, including definitions of <i><b>big
|
||||||
endian</b></i> and <i><b>little endian</b></i>.</p>
|
endian</b></i> and <i><b>little endian</b></i>.</p>
|
||||||
<p>Header <a href="buffers.html">boost/endian/buffers.hpp</a>
|
<p>Header <b><code>boost/endian/buffers.hpp</code></b>
|
||||||
provides <code>endian_buffer</code>, a portable endian integer and floating-point binary buffer
|
provides <code>endian_buffer</code>, a portable endian integer and floating-point binary buffer
|
||||||
class template with control over
|
class template with control over
|
||||||
byte order, value type, size, and alignment independent of the platform's native
|
byte order, value type, size, and alignment independent of the platform's native
|
||||||
@ -94,22 +84,23 @@ base class for the <code><a href="arithmetic.html">endian_arithmetic</a></code>
|
|||||||
class template, which is aimed at users who wish fully automatic endianness
|
class template, which is aimed at users who wish fully automatic endianness
|
||||||
conversion and direct support for all normal arithmetic operations.</p>
|
conversion and direct support for all normal arithmetic operations.</p>
|
||||||
<h2><a name="Example">Example</a></h2>
|
<h2><a name="Example">Example</a></h2>
|
||||||
<p>The <a href="../example/endian_example.cpp">endian_example.cpp</a> program writes a
|
<p>The <b><code>example/endian_example.cpp</code></b> program writes a
|
||||||
binary file containing four byte big-endian and little-endian integers:</p>
|
binary file containing four byte big-endian and little-endian integers:</p>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<pre>#include <iostream>
|
<pre>#include <iostream>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <boost/endian/buffers.hpp>
|
#include <boost/endian/buffers.hpp> // see <a href="#Synopsis">Synopsis</a> below
|
||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
|
|
||||||
using namespace boost::endian;
|
using namespace boost::endian;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
// This is an extract from a very widely used GIS file format. Why the designer
|
// This is an extract from a very widely used GIS file format.
|
||||||
// decided to mix big and little endians in the same file is not known. But
|
// Why the designer decided to mix big and little endians in
|
||||||
// this is a real-world format and users wishing to write low level code
|
// the same file is not known. But this is a real-world format
|
||||||
// manipulating these files have to deal with the mixed endianness.
|
// and users wishing to write low level code manipulating these
|
||||||
|
// files have to deal with the mixed endianness.
|
||||||
|
|
||||||
struct header
|
struct header
|
||||||
{
|
{
|
||||||
@ -133,11 +124,13 @@ int main(int, char* [])
|
|||||||
h.version = 1;
|
h.version = 1;
|
||||||
h.shape_type = 0x01020304;
|
h.shape_type = 0x01020304;
|
||||||
|
|
||||||
// Low-level I/O such as POSIX read/write or <cstdio> fread/fwrite is sometimes
|
// Low-level I/O such as POSIX read/write or <cstdio>
|
||||||
// used for binary file operations when ultimate efficiency is important. Such
|
// fread/fwrite is sometimes used for binary file operations
|
||||||
// I/O is often performed in some C++ wrapper class, but to drive home the
|
// when ultimate efficiency is important. Such I/O is often
|
||||||
// point that endian integers are often used in fairly low-level code that does
|
// performed in some C++ wrapper class, but to drive home the
|
||||||
// bulk I/O operations, <cstdio> fopen/fwrite is used for I/O in this example.
|
// point that endian integers are often used in fairly
|
||||||
|
// low-level code that does bulk I/O operations, <cstdio>
|
||||||
|
// fopen/fwrite is used for I/O in this example.
|
||||||
|
|
||||||
std::FILE* fi = std::fopen(filename, "wb"); // MUST BE BINARY
|
std::FILE* fi = std::fopen(filename, "wb"); // MUST BE BINARY
|
||||||
|
|
||||||
@ -161,7 +154,7 @@ int main(int, char* [])
|
|||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<p>After compiling and executing <a href="../example/endian_example.cpp">endian_example.cpp</a>,
|
<p>After compiling and executing <b><code>example/endian_example.cpp</code></b>,
|
||||||
a hex dump of <code>test.dat</code> shows:</p>
|
a hex dump of <code>test.dat</code> shows:</p>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<pre>01020304 00000010 01000000 04030201</pre>
|
<pre>01020304 00000010 01000000 04030201</pre>
|
||||||
@ -340,7 +333,7 @@ requirements vary between hardware architectures and because alignment may be
|
|||||||
affected by compiler switches or pragmas. For example, alignment of an 64-bit
|
affected by compiler switches or pragmas. For example, alignment of an 64-bit
|
||||||
integer may be to a 32-bit boundary on a 32-bit machine. Furthermore, aligned types
|
integer may be to a 32-bit boundary on a 32-bit machine. Furthermore, aligned types
|
||||||
are only available on architectures with 16, 32, and 64-bit integer types. </p>
|
are only available on architectures with 16, 32, and 64-bit integer types. </p>
|
||||||
<p><b><i>Note:</i></b> One-byte types
|
<p><b><i>Note:</i></b> One-byte big and little buffer types
|
||||||
have identical
|
have identical
|
||||||
functionality. They are provided to improve code readability and searchability.</p>
|
functionality. They are provided to improve code readability and searchability.</p>
|
||||||
<h2><a name="Class_template_endian">Class template <code>endian</code></a><code>_buffer</code></h2>
|
<h2><a name="Class_template_endian">Class template <code>endian</code></a><code>_buffer</code></h2>
|
||||||
@ -380,18 +373,18 @@ usual operations on integers are supplied.</p>
|
|||||||
};
|
};
|
||||||
|
|
||||||
// stream inserter
|
// stream inserter
|
||||||
template <class charT, class traits, BOOST_SCOPED_ENUM(order) Order, class T,
|
template <class charT, class traits, order Order, class T,
|
||||||
std::size_t n_bits, BOOST_SCOPED_ENUM(align) A>
|
std::size_t n_bits, align Align>
|
||||||
std::basic_ostream<charT, traits>&
|
std::basic_ostream<charT, traits>&
|
||||||
operator<<(std::basic_ostream<charT, traits>& os,
|
<a href="#inserter">operator<<</a>(std::basic_ostream<charT, traits>& os,
|
||||||
const endian_buffer<Order, T, n_bits, A>& x);
|
const endian_buffer<Order, T, n_bits, Align>& x);
|
||||||
|
|
||||||
// stream extractor
|
// stream extractor
|
||||||
template <class charT, class traits, BOOST_SCOPED_ENUM(order) Order, class T,
|
template <class charT, class traits, order Order, class T,
|
||||||
std::size_t n_bits, BOOST_SCOPED_ENUM(align) A>
|
std::size_t n_bits, align A>
|
||||||
std::basic_istream<charT, traits>&
|
std::basic_istream<charT, traits>&
|
||||||
operator>>(std::basic_istream<charT, traits>& is,
|
<a href="#extractor">operator>></a>(std::basic_istream<charT, traits>& is,
|
||||||
endian_buffer<Order, T, n_bits, A>& x);
|
endian_buffer<Order, T, n_bits, Align>& x);
|
||||||
|
|
||||||
// typedefs
|
// typedefs
|
||||||
|
|
||||||
@ -494,7 +487,6 @@ usual operations on integers are supplied.</p>
|
|||||||
typedef <b><i>implementation-defined</i></b>_uint56_buf_ut native_uint56_buf_ut;
|
typedef <b><i>implementation-defined</i></b>_uint56_buf_ut native_uint56_buf_ut;
|
||||||
typedef <b><i>implementation-defined</i></b>_uint64_buf_ut native_uint64_buf_ut;
|
typedef <b><i>implementation-defined</i></b>_uint64_buf_ut native_uint64_buf_ut;
|
||||||
|
|
||||||
|
|
||||||
} // namespace endian
|
} // namespace endian
|
||||||
} // namespace boost</pre>
|
} // namespace boost</pre>
|
||||||
<p>The <i><b><code>implementation-defined</code></b></i> text in typedefs above is either
|
<p>The <i><b><code>implementation-defined</code></b></i> text in typedefs above is either
|
||||||
@ -554,6 +546,30 @@ boost::endian::endian_reverse</code>.</p>
|
|||||||
<blockquote>
|
<blockquote>
|
||||||
<p><i>Returns:</i> A pointer to the first byte of <code>endian_value</code>.</p>
|
<p><i>Returns:</i> A pointer to the first byte of <code>endian_value</code>.</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
<h3><a name="Non-member-functions">Non-member functions</a></h3>
|
||||||
|
<pre>template <class charT, class traits, order Order, class T,
|
||||||
|
std::size_t n_bits, align Align>
|
||||||
|
std::basic_ostream<charT, traits>& <a name="inserter">operator<<</a>(std::basic_ostream<charT, traits>& os,
|
||||||
|
const endian_buffer<Order, T, n_bits, Align>& x);
|
||||||
|
</pre>
|
||||||
|
<blockquote>
|
||||||
|
<p><i>Returns:</i> <code>os << x.value()</code>.</p>
|
||||||
|
</blockquote>
|
||||||
|
<pre>template <class charT, class traits, order Order, class T,
|
||||||
|
std::size_t n_bits, align A>
|
||||||
|
std::basic_istream<charT, traits>& <a name="extractor">operator>></a>(std::basic_istream<charT, traits>& is,
|
||||||
|
endian_buffer<Order, T, n_bits, Align>& x);
|
||||||
|
</pre>
|
||||||
|
<blockquote>
|
||||||
|
<p><i>Effects: </i>As if:</p>
|
||||||
|
<blockquote>
|
||||||
|
<pre>T i;
|
||||||
|
if (is >> i)
|
||||||
|
x = i;
|
||||||
|
</pre>
|
||||||
|
</blockquote>
|
||||||
|
<p><i>Returns:</i> <code>is</code>.</p>
|
||||||
|
</blockquote>
|
||||||
<h2><a name="FAQ">FAQ</a></h2>
|
<h2><a name="FAQ">FAQ</a></h2>
|
||||||
|
|
||||||
<p>See the <a href="index.html#FAQ">Endian home page</a> FAQ for a library-wide
|
<p>See the <a href="index.html#FAQ">Endian home page</a> FAQ for a library-wide
|
||||||
|
@ -60,17 +60,7 @@ as needed, locally in anticipation</a><br>
|
|||||||
<a href="#Reliability-arithmetic-speed">Reliability and arithmetic-speed</a><br>
|
<a href="#Reliability-arithmetic-speed">Reliability and arithmetic-speed</a><br>
|
||||||
<a href="#Reliability-ease-of-use">Reliability and ease-of-use</a></td>
|
<a href="#Reliability-ease-of-use">Reliability and ease-of-use</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
</table>
|
||||||
<td width="100%" bgcolor="#D7EEFF" align="center">
|
|
||||||
<b><i>Headers</i></b></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="100%" bgcolor="#E8F5FF">
|
|
||||||
<a href="../include/boost/endian/conversion.hpp"><boost/endian/conversion.hpp></a><br>
|
|
||||||
<a href="../include/boost/endian/buffers.hpp"><boost/endian/buffers.hpp></a><br>
|
|
||||||
<a href="../include/boost/endian/arithmetic.hpp"><boost/endian/arithmetic.hpp></a></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<h2><a name="Introduction">Introduction</a></h2>
|
<h2><a name="Introduction">Introduction</a></h2>
|
||||||
|
|
||||||
@ -410,7 +400,7 @@ arithmetic approach</a>.</p>
|
|||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
<p>Last revised:
|
<p>Last revised:
|
||||||
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->08 January, 2015<!--webbot bot="Timestamp" endspan i-checksum="38900" --></p>
|
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->17 January, 2015<!--webbot bot="Timestamp" endspan i-checksum="38899" --></p>
|
||||||
<p>© Copyright Beman Dawes, 2011, 2013, 2014</p>
|
<p>© Copyright Beman Dawes, 2011, 2013, 2014</p>
|
||||||
<p>Distributed under the Boost Software License, Version 1.0. See
|
<p>Distributed under the Boost Software License, Version 1.0. See
|
||||||
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/ LICENSE_1_0.txt</a></p>
|
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/ LICENSE_1_0.txt</a></p>
|
||||||
|
@ -53,17 +53,7 @@
|
|||||||
<a href="#FAQ">FAQ</a><br>
|
<a href="#FAQ">FAQ</a><br>
|
||||||
<a href="#Acknowledgements">Acknowledgements</a></td>
|
<a href="#Acknowledgements">Acknowledgements</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
</table>
|
||||||
<td width="100%" bgcolor="#D7EEFF" align="center">
|
|
||||||
<b><i>Headers</i></b></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="100%" bgcolor="#E8F5FF">
|
|
||||||
<a href="../include/boost/endian/conversion.hpp"><boost/endian/conversion.hpp></a><br>
|
|
||||||
<a href="../include/boost/endian/buffers.hpp"><boost/endian/buffers.hpp></a><br>
|
|
||||||
<a href="../include/boost/endian/arithmetic.hpp"><boost/endian/arithmetic.hpp></a></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<h2><a name="Introduction">Introduction</a></h2>
|
<h2><a name="Introduction">Introduction</a></h2>
|
||||||
|
|
||||||
@ -233,8 +223,7 @@ call to <code>endian_reverse()</code>.</p>
|
|||||||
<a href="#EndianReversibleInplace">EndianReversibleInplace</a></code> are required to perform reversal of endianness if needed by making an
|
<a href="#EndianReversibleInplace">EndianReversibleInplace</a></code> are required to perform reversal of endianness if needed by making an
|
||||||
unqualified call to <code>endian_reverse_inplace()</code>.</p>
|
unqualified call to <code>endian_reverse_inplace()</code>.</p>
|
||||||
|
|
||||||
<p> See <a href="../example/udt_conversion_example.cpp">
|
<p> See <b><code>example/udt_conversion_example.cpp</code></b> for an example user-defined type.</p>
|
||||||
udt_conversion_example.cpp</a> for an example user-defined type.</p>
|
|
||||||
|
|
||||||
<h3><a name="Functions">Functions</a></h3>
|
<h3><a name="Functions">Functions</a></h3>
|
||||||
<pre><a name="endian_reverse"></a>int8_t endian_reverse(int8_t x) noexcept;
|
<pre><a name="endian_reverse"></a>int8_t endian_reverse(int8_t x) noexcept;
|
||||||
@ -372,12 +361,13 @@ portability for both programs and data.</p>
|
|||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
<h2><a name="Acknowledgements">Acknowledgements</a></h2><p>Tomas Puverle was instrumental in identifying and articulating the need to
|
<h2><a name="Acknowledgements">Acknowledgements</a></h2><p>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 <a href="../include/boost/endian/detail/intrinsic.hpp">boost/endian/detail/intrinsic.hpp</a>.
|
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
|
||||||
|
<b><code>boost/endian/detail/intrinsic.hpp</code></b>.
|
||||||
Pierre Talbot provided the <code>int8_t endian_reverse()</code> and templated
|
Pierre Talbot provided the <code>int8_t endian_reverse()</code> and templated
|
||||||
<code>endian_reverse_inplace()</code> implementations.</p>
|
<code>endian_reverse_inplace()</code> implementations.</p>
|
||||||
<hr>
|
<hr>
|
||||||
<p>Last revised:
|
<p>Last revised:
|
||||||
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->04 January, 2015<!--webbot bot="Timestamp" endspan i-checksum="38892" --></p>
|
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->17 January, 2015<!--webbot bot="Timestamp" endspan i-checksum="38899" --></p>
|
||||||
<p>© Copyright Beman Dawes, 2011, 2013</p>
|
<p>© Copyright Beman Dawes, 2011, 2013</p>
|
||||||
<p>Distributed under the Boost Software License, Version 1.0. See <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/ LICENSE_1_0.txt</a></p>
|
<p>Distributed under the Boost Software License, Version 1.0. See <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/ LICENSE_1_0.txt</a></p>
|
||||||
|
|
||||||
|
260
doc/index.html
260
doc/index.html
@ -49,8 +49,7 @@
|
|||||||
<a href="#Choosing">buffer types, and arithmetic types</a><br>
|
<a href="#Choosing">buffer types, and arithmetic types</a><br>
|
||||||
<a href="#Intrinsic">Built-in support for Intrinsics</a><br>
|
<a href="#Intrinsic">Built-in support for Intrinsics</a><br>
|
||||||
<a href="#Performance">Performance</a><br>
|
<a href="#Performance">Performance</a><br>
|
||||||
<a href="#Timings">Timings for Example 2</a><br>
|
<a href="#Timings">Timings</a><br>
|
||||||
<a href="#Conclusions">Conclusions</a><br>
|
|
||||||
<a href="#FAQ">Overall FAQ</a><br>
|
<a href="#FAQ">Overall FAQ</a><br>
|
||||||
<a href="#Release-history">Release history</a><br>
|
<a href="#Release-history">Release history</a><br>
|
||||||
<a href="#Changes-requested-by-formal-review">Changes
|
<a href="#Changes-requested-by-formal-review">Changes
|
||||||
@ -60,17 +59,7 @@ formal review</a><br>
|
|||||||
<a href="#Acknowledgements">Acknowledgements</a><br>
|
<a href="#Acknowledgements">Acknowledgements</a><br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
</table>
|
||||||
<td width="100%" bgcolor="#D7EEFF" align="center">
|
|
||||||
<b><i>Headers</i></b></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="100%" bgcolor="#E8F5FF">
|
|
||||||
<a href="../include/boost/endian/conversion.hpp"><boost/endian/conversion.hpp></a><br>
|
|
||||||
<a href="../include/boost/endian/buffers.hpp"><boost/endian/buffers.hpp></a><br>
|
|
||||||
<a href="../include/boost/endian/arithmetic.hpp"><boost/endian/arithmetic.hpp></a></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<h2><a name="Abstract">Abstract</a></h2>
|
<h2><a name="Abstract">Abstract</a></h2>
|
||||||
|
|
||||||
@ -308,236 +297,55 @@ big endian is done inside the loop. With the Endian conversion function
|
|||||||
approach, the user has ensured the conversions are done outside the loop, so the
|
approach, the user has ensured the conversions are done outside the loop, so the
|
||||||
code may run more quickly on little endian platforms.</p>
|
code may run more quickly on little endian platforms.</p>
|
||||||
|
|
||||||
<h3><a name="Timings">Timings</a> for Example 2 (conversion functions hoisted
|
<h3><a name="Timings">Timings</a></h3>
|
||||||
out of loop)</h3>
|
|
||||||
<p>These tests were run against release builds on a circa 2012 4-core little endian X64 Intel Core i5-3570K
|
<p>These tests were run against release builds on a circa 2012 4-core little endian X64 Intel Core i5-3570K
|
||||||
CPU @ 3.40GHz under Windows 7.</p>
|
CPU @ 3.40GHz under Windows 7.</p>
|
||||||
|
|
||||||
<p><b>Caveat emptor: The Windows CPU timer has very high granularity. Repeated
|
<p><b>Caveat emptor: The Windows CPU timer has very high granularity. Repeated
|
||||||
runs of the same tests often yield considerably different results.</b></p>
|
runs of the same tests often yield considerably different results.</b></p>
|
||||||
|
|
||||||
<p>See <a href="../test/loop_time_test.cpp">loop_time_test.cpp</a> and
|
<p>See <b>test/loop_time_test.cpp</b> for the actual code and <b>benchmark/Jamfile.v2</b> for the build
|
||||||
<a href="../benchmark/Jamfile.v2">Jamfile.v2</a> for the actual code and build
|
|
||||||
setup.</p>
|
setup.</p>
|
||||||
|
|
||||||
<div align="center">
|
|
||||||
<center>
|
|
||||||
|
|
||||||
<table border="1" cellpadding="5" cellspacing="0"style="border-collapse: collapse" bordercolor="#111111">
|
|
||||||
<tr><td colspan="6" align="center"><b><font size="2">GNU C++ version 4.7.0</font></b></td></tr>
|
|
||||||
<tr><td colspan="6" align="center"><b> <font size="2">Iterations: 1000000000, Intrinsics: __builtin_bswap16, etc.</font></b></td></tr>
|
|
||||||
<tr><td><b><font size="2">Test Case</font></b></td>
|
|
||||||
<td align="center"><b><font size="2">Endian<br>arithmetic</font></b></td>
|
|
||||||
<td align="center"><b><font size="2">Endian<br>conversion<br>function</font></b></td>
|
|
||||||
</tr>
|
|
||||||
<tr><td><font size="2">16-bit aligned big endian</font></td>
|
|
||||||
<td align="right"><font size="2">1.37 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.81 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">16-bit aligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">0.83 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.81 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">16-bit unaligned big endian</font></td>
|
|
||||||
<td align="right"><font size="2">1.09 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.83 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">16-bit unaligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">1.09 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.81 s</font></td></tr>
|
|
||||||
<tr><td><b><font size="2">32-bit aligned big endian</font></b></td>
|
|
||||||
<td align="right"><b><font size="2">0.98 s</font></b></td>
|
|
||||||
<td align="right"><b><font size="2">0.27 s</font></b></td></tr>
|
|
||||||
<tr><td><font size="2">32-bit aligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">0.28 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.27 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">32-bit unaligned big endian</font></td>
|
|
||||||
<td align="right"><font size="2">3.82 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.27 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">32-bit unaligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">3.82 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.27 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">64-bit aligned big endian</font></td>
|
|
||||||
<td align="right"><font size="2">1.65 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.41 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">64-bit aligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">0.41 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.41 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">64-bit unaligned big endian</font></td>
|
|
||||||
<td align="right"><font size="2">17.53 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.41 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">64-bit unaligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">17.52 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.41 s</font></td></tr>
|
|
||||||
|
|
||||||
<tr><td colspan="6" align="center"><b> <font size="2">Iterations: 1000000000, Intrinsics: no byte swap intrinsics</font></b></td></tr>
|
|
||||||
<tr><td><b><font size="2">Test Case</font></b></td>
|
|
||||||
<td align="center"><b><font size="2">Endian<br>arithmetic</font></b></td>
|
|
||||||
<td align="center"><b><font size="2">Endian<br>conversion<br>function</font></b></td>
|
|
||||||
</tr>
|
|
||||||
<tr><td><font size="2">16-bit aligned big endian</font></td>
|
|
||||||
<td align="right"><font size="2">1.95 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.81 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">16-bit aligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">0.83 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.81 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">16-bit unaligned big endian</font></td>
|
|
||||||
<td align="right"><font size="2">1.19 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.81 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">16-bit unaligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">1.20 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.81 s</font></td></tr>
|
|
||||||
<tr><td><b><font size="2">32-bit aligned big endian</font></b></td>
|
|
||||||
<td align="right"><b><font size="2">0.97 s</font></b></td>
|
|
||||||
<td align="right"><b><font size="2">0.28 s</font></b></td></tr>
|
|
||||||
<tr><td><font size="2">32-bit aligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">0.27 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.28 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">32-bit unaligned big endian</font></td>
|
|
||||||
<td align="right"><font size="2">4.10 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.27 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">32-bit unaligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">4.10 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.27 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">64-bit aligned big endian</font></td>
|
|
||||||
<td align="right"><font size="2">1.64 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.42 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">64-bit aligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">0.41 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.41 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">64-bit unaligned big endian</font></td>
|
|
||||||
<td align="right"><font size="2">17.52 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.42 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">64-bit unaligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">17.52 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.41 s</font></td></tr>
|
|
||||||
|
|
||||||
</table>
|
|
||||||
|
|
||||||
</center>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p><b>Comment:</b> Note that the <b><font size="2">32-bit aligned big endian </font></b>
|
|
||||||
timings are the same with or without intrinsics turned on. Presumably the
|
|
||||||
optimizer is recognizing the byte swapping and applying the intrinsics itself.</p>
|
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<center>
|
<center>
|
||||||
|
|
||||||
<table border="1" cellpadding="5" cellspacing="0"style="border-collapse: collapse" bordercolor="#111111">
|
<table border="1" cellpadding="5" cellspacing="0"style="border-collapse: collapse" bordercolor="#111111">
|
||||||
<tr><td colspan="6" align="center"><b><font size="2">Microsoft Visual C++ version 11.0</font></b></td></tr>
|
<tr><td colspan="6" align="center"><b>GNU C++ version 4.8.2 on Linux virtual
|
||||||
<tr><td colspan="6" align="center"><b> <font size="2">Iterations: 1000000000, Intrinsics: cstdlib _byteswap_ushort, etc.</font></b></td></tr>
|
machine</b></td></tr>
|
||||||
<tr><td><b><font size="2">Test Case</font></b></td>
|
<tr><td colspan="6" align="center"><b> Iterations: 10'000'000'000, Intrinsics: __builtin_bswap16, etc.</b></td></tr>
|
||||||
<td align="center"><b><font size="2">Endian<br>type</font></b></td>
|
<tr><td><b>Test Case</b></td>
|
||||||
<td align="center"><b><font size="2">Endian<br>conversion<br>function</font></b></td>
|
<td align="center"><b>Endian<br>arithmetic<br>type</b></td>
|
||||||
|
<td align="center"><b>Endian<br>conversion<br>function</b></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td><font size="2">16-bit aligned big endian</font></td>
|
<tr><td>16-bit aligned big endian</td><td align="right">8.46 s</td><td align="right">5.28 s</td></tr>
|
||||||
<td align="right"><font size="2">0.83 s</font></td>
|
<tr><td>16-bit aligned little endian</td><td align="right">5.28 s</td><td align="right">5.22 s</td></tr>
|
||||||
<td align="right"><font size="2">0.51 s</font></td></tr>
|
<tr><td>32-bit aligned big endian</td><td align="right">8.40 s</td><td align="right">2.11 s</td></tr>
|
||||||
<tr><td><font size="2">16-bit aligned little endian</font></td>
|
<tr><td>32-bit aligned little endian</td><td align="right">2.11 s</td><td align="right">2.10 s</td></tr>
|
||||||
<td align="right"><font size="2">0.51 s</font></td>
|
<tr><td>64-bit aligned big endian</td><td align="right">14.02 s</td><td align="right">3.10 s</td></tr>
|
||||||
<td align="right"><font size="2">0.50 s</font></td></tr>
|
<tr><td>64-bit aligned little endian</td><td align="right">3.00 s</td><td align="right">3.03 s</td></tr>
|
||||||
<tr><td><font size="2">16-bit unaligned big endian</font></td>
|
|
||||||
<td align="right"><font size="2">1.37 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.51 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">16-bit unaligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">1.37 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.50 s</font></td></tr>
|
|
||||||
<tr><td><b><font size="2">32-bit aligned big endian</font></b></td>
|
|
||||||
<td align="right"><b><font size="2">0.81 s</font></b></td>
|
|
||||||
<td align="right"><b><font size="2">0.50 s</font></b></td></tr>
|
|
||||||
<tr><td><font size="2">32-bit aligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">0.51 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.51 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">32-bit unaligned big endian</font></td>
|
|
||||||
<td align="right"><font size="2">2.98 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.53 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">32-bit unaligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">3.00 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.51 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">64-bit aligned big endian</font></td>
|
|
||||||
<td align="right"><font size="2">1.33 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.33 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">64-bit aligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">0.34 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.27 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">64-bit unaligned big endian</font></td>
|
|
||||||
<td align="right"><font size="2">7.05 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.33 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">64-bit unaligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">7.11 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.31 s</font></td></tr>
|
|
||||||
|
|
||||||
<tr><td colspan="6" align="center"><b> <font size="2">Iterations: 1000000000, Intrinsics: no byte swap intrinsics</font></b></td></tr>
|
|
||||||
<tr><td><b><font size="2">Test Case</font></b></td>
|
|
||||||
<td align="center"><b><font size="2">Endian<br>type</font></b></td>
|
|
||||||
<td align="center"><b><font size="2">Endian<br>conversion<br>function</font></b></td>
|
|
||||||
</tr>
|
|
||||||
<tr><td><font size="2">16-bit aligned big endian</font></td>
|
|
||||||
<td align="right"><font size="2">0.83 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.51 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">16-bit aligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">0.51 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.51 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">16-bit unaligned big endian</font></td>
|
|
||||||
<td align="right"><font size="2">1.36 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.51 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">16-bit unaligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">1.37 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.51 s</font></td></tr>
|
|
||||||
<tr><td><b><font size="2">32-bit aligned big endian</font></b></td>
|
|
||||||
<td align="right"><b><font size="2">3.42 s</font></b></td>
|
|
||||||
<td align="right"><b><font size="2">0.50 s</font></b></td></tr>
|
|
||||||
<tr><td><font size="2">32-bit aligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">0.51 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.51 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">32-bit unaligned big endian</font></td>
|
|
||||||
<td align="right"><font size="2">2.93 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.50 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">32-bit unaligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">2.95 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.50 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">64-bit aligned big endian</font></td>
|
|
||||||
<td align="right"><font size="2">5.99 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.33 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">64-bit aligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">0.33 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.33 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">64-bit unaligned big endian</font></td>
|
|
||||||
<td align="right"><font size="2">7.02 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.27 s</font></td></tr>
|
|
||||||
<tr><td><font size="2">64-bit unaligned little endian</font></td>
|
|
||||||
<td align="right"><font size="2">7.02 s</font></td>
|
|
||||||
<td align="right"><font size="2">0.27 s</font></td></tr>
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
</center>
|
</center>
|
||||||
</div>
|
</div>
|
||||||
|
<p></p>
|
||||||
|
|
||||||
|
<div align="center"> <center>
|
||||||
<h3><a name="Conclusions">Conclusions</a></h3>
|
<table border="1" cellpadding="5" cellspacing="0"style="border-collapse: collapse" bordercolor="#111111">
|
||||||
|
<tr><td colspan="6" align="center"><b>Microsoft Visual C++ version 14.0</b></td></tr>
|
||||||
<p>When program logic dictates many more conversions for the Endian arithmetic
|
<tr><td colspan="6" align="center"><b> Iterations: 10'000'000'000, Intrinsics: cstdlib _byteswap_ushort, etc.</b></td></tr>
|
||||||
approach than the Endian conversion function approach (<a href="#Example-2">example
|
<tr><td><b>Test Case</b></td>
|
||||||
2</a>):</p>
|
<td align="center"><b>Endian<br>arithmetic<br>type</b></td>
|
||||||
|
<td align="center"><b>Endian<br>conversion<br>function</b></td>
|
||||||
<blockquote>
|
</tr>
|
||||||
|
<tr><td>16-bit aligned big endian</td><td align="right">8.27 s</td><td align="right">5.26 s</td></tr>
|
||||||
<p><b>There may be a considerable performance difference. </b>If machine endianness differs from the
|
<tr><td>16-bit aligned little endian</td><td align="right">5.29 s</td><td align="right">5.32 s</td></tr>
|
||||||
desired endianness, the Endian arithmetic approach must do the byte reversal many
|
<tr><td>32-bit aligned big endian</td><td align="right">8.36 s</td><td align="right">5.24 s</td></tr>
|
||||||
times while the Endian conversion approach only does the reversal once. But if
|
<tr><td>32-bit aligned little endian</td><td align="right">5.24 s</td><td align="right">5.24 s</td></tr>
|
||||||
the endianness is the same, there is no conversion with either approach and no
|
<tr><td>64-bit aligned big endian</td><td align="right">13.65 s</td><td align="right">3.34 s</td></tr>
|
||||||
conversion code is generated for typical release builds.</p>
|
<tr><td>64-bit aligned little endian</td><td align="right">3.35 s</td><td align="right">2.73 s</td></tr>
|
||||||
|
</table>
|
||||||
<p><b>Whether or not compiler byte swap intrinsics are explicitly available has little
|
</center></div>
|
||||||
impact on GCC but a lot of impact on Visual C++, for the tested compiler
|
|
||||||
versions.</b> Yet another example of why actual timing tests are needed to
|
|
||||||
determine if some coding technique has significant impact on performance.</p>
|
|
||||||
|
|
||||||
<p><b>Unaligned types are much slower that aligned types, regardless of
|
|
||||||
endianness considerations.</b> Instead of single instruction register loads and
|
|
||||||
stores, multiple instructions are required on common platforms.</p>
|
|
||||||
|
|
||||||
</blockquote>
|
|
||||||
|
|
||||||
|
|
||||||
<h2>Overall <a name="FAQ">FAQ</a></h2>
|
<h2>Overall <a name="FAQ">FAQ</a></h2>
|
||||||
@ -676,7 +484,7 @@ Blechmann, Tim Moore, tymofey, Tomas Puverle, Vincente Botet, Yuval Ronen and
|
|||||||
Vitaly Budovsk. Apologies if anyone has been missed.</p>
|
Vitaly Budovsk. Apologies if anyone has been missed.</p>
|
||||||
<hr>
|
<hr>
|
||||||
<p>Last revised:
|
<p>Last revised:
|
||||||
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->12 January, 2015<!--webbot bot="Timestamp" endspan i-checksum="38889" --></p>
|
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->15 January, 2015<!--webbot bot="Timestamp" endspan i-checksum="38895" --></p>
|
||||||
<p>© Copyright Beman Dawes, 2011, 2013</p>
|
<p>© Copyright Beman Dawes, 2011, 2013</p>
|
||||||
<p>Distributed under the Boost Software License, Version 1.0. See
|
<p>Distributed under the Boost Software License, Version 1.0. See
|
||||||
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/ LICENSE_1_0.txt</a></p>
|
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/ LICENSE_1_0.txt</a></p>
|
||||||
|
@ -12,23 +12,9 @@
|
|||||||
|
|
||||||
<h1>Endian Library TODO List</h1>
|
<h1>Endian Library TODO List</h1>
|
||||||
|
|
||||||
<p>Last revised:
|
|
||||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->17 December, 2014<!--webbot bot="Timestamp" endspan i-checksum="38647" --></p>
|
|
||||||
|
|
||||||
<p><b>August 12, 2014: The many items that have been completed should be
|
|
||||||
removed, after verifying that they are in fact taken care of.</b></p>
|
|
||||||
<h2>To Do</h2>
|
<h2>To Do</h2>
|
||||||
<ul>
|
|
||||||
<li>Develop the use-cases example programs, using plain integers and UDT's.</li>
|
|
||||||
<li>Review UDT examples.</li>
|
|
||||||
<li>Review buffer stream extractors and inserters, and how they work for
|
|
||||||
arithmetic types. TEST. Make sure nothing got dropped on the floor during
|
|
||||||
buffer decomposition.</li>
|
|
||||||
<li><span style="background-color: #FFFF00">Run inspect.</span>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<h2>Format Review Comments</h2>
|
<h2>Format Review Comments</h2>
|
||||||
<h3 dir="ltr">Votes</h3>
|
<h3 dir="ltr">Interesting</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li dir="ltr">
|
<li dir="ltr">
|
||||||
<p dir="ltr">John Filo - "Absolutely. I'd like to see support for float and
|
<p dir="ltr">John Filo - "Absolutely. I'd like to see support for float and
|
||||||
@ -52,26 +38,6 @@ removed, after verifying that they are in fact taken care of.</b></p>
|
|||||||
Spirit with the reviewed version. All of Spirits regression tests still <br>
|
Spirit with the reviewed version. All of Spirits regression tests still <br>
|
||||||
pass. "<br>
|
pass. "<br>
|
||||||
</li>
|
</li>
|
||||||
<li dir="ltr">
|
|
||||||
<p dir="ltr">Robert Stewart - "There are issues that keep me from saying yes
|
|
||||||
at this time. There are too many suggested variations and ideas under
|
|
||||||
consideration to accept the library in its present state. However, a
|
|
||||||
mini-review should be sufficient to evaluate the final form, once Beman
|
|
||||||
determines a course of action, and determine whether to accept it or not."<br>
|
|
||||||
</li>
|
|
||||||
<li dir="ltr">
|
|
||||||
<p dir="ltr">Tim Blechmann - "the library should be accepted, if<br>
|
|
||||||
<br>
|
|
||||||
(a) the interface of the conversion functions is changed<br>
|
|
||||||
(b) the performance can be improved<br>
|
|
||||||
(c) the documentation integrates better with the rest of the boost<br>
|
|
||||||
documentation."<br>
|
|
||||||
</li>
|
|
||||||
<li dir="ltr">
|
|
||||||
<p dir="ltr">Vicente J. Botet Escriba - "No in its current state.<br>
|
|
||||||
Once the library takes in account the requested modification (that Beman has
|
|
||||||
already accepted) a mini-review will be necessary to improve the library
|
|
||||||
before release."</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<h3>Executive summary</h3>
|
<h3>Executive summary</h3>
|
||||||
<ul>
|
<ul>
|
||||||
@ -109,37 +75,6 @@ removed, after verifying that they are in fact taken care of.</b></p>
|
|||||||
</ul>
|
</ul>
|
||||||
<h3>Docs</h3>
|
<h3>Docs</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Document use of endian integers with stream inserters and extractors.</li>
|
|
||||||
<li>Conversion in note mention similarity to htonl() , etc.</li>
|
|
||||||
<li>Conversion: add discussion of alignment, packing, etc. Bottom line; use at
|
|
||||||
your own risk. Use Phil's example:<br>
|
|
||||||
struct S {<br>
|
|
||||||
uint16_t a;<br>
|
|
||||||
uint32_t b;<br>
|
|
||||||
} __attribute__ ((packed));</li>
|
|
||||||
<li>Requirements for template parameters. </li>
|
|
||||||
<li>UDTs<ul>
|
|
||||||
<li>Integers</li>
|
|
||||||
<li>Conversion</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>Distinguish use cases and recommendations for which approach (integers vs
|
|
||||||
conversion) is appropriate.<ul>
|
|
||||||
<li><a href="http://lists.boost.org/Archives/boost/2011/09/185698.php">
|
|
||||||
http://lists.boost.org/Archives/boost/2011/09/185698.php</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>> section `experience': this section gives no insights for people who use
|
|
||||||
or<br>
|
|
||||||
> read the code. it mainly tells: "we are not the first and the domain of the<br>
|
|
||||||
> library is important.". imo this section can be removed (maybe the part that<br>
|
|
||||||
> it is not related to any c library can go to the `design considerations'<br>
|
|
||||||
><br>
|
|
||||||
> section "motivating use cases": this is more a marketing blurb/testimonial.<br>
|
|
||||||
> maybe this could be changed to a section about possible use cases, listing<br>
|
|
||||||
> `communicating between different devices' and `reading/writing of binary
|
|
||||||
file<br>
|
|
||||||
> formats'.</li>
|
|
||||||
<li>one other point ... the help file seems to directly link to the c++
|
<li>one other point ... the help file seems to directly link to the c++
|
||||||
headers.<br>
|
headers.<br>
|
||||||
this should be changed:<br>
|
this should be changed:<br>
|
||||||
@ -157,75 +92,10 @@ removed, after verifying that they are in fact taken care of.</b></p>
|
|||||||
<br>
|
<br>
|
||||||
so i'd suggest to completely remove the links to the c++ headers.<br>
|
so i'd suggest to completely remove the links to the c++ headers.<br>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<div class="im">
|
|
||||||
> explaining the other builting types are not considered. Why only
|
|
||||||
big/little<br>
|
|
||||||
> endianness has been taken in account?</div>
|
|
||||||
<p>I'll add FAQ and/or add more entries to the final docs.<br>
|
|
||||||
<br>
|
|
||||||
Only big/little endianness is taken into account because these are the<br>
|
|
||||||
only endian schemes that have any practical value. All the others are<br>
|
|
||||||
just historical curiosities.</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<h3>Code</h3>
|
|
||||||
<p>Also change docs if applicable.</p>
|
|
||||||
<ul>
|
|
||||||
<li><span style="background-color: #FFCCFF">Beman: TODO</span><span style="background-color: #FFCCFF">:
|
|
||||||
</span><span style="background-color: #FFCCFF">Google</span><span style="background-color: #FFCCFF">
|
|
||||||
"unaligned integer", look at various entries. For example, http://</span><span style="background-color: #FFCCFF">infocenter.arm.com</span><span style="background-color: #FFCCFF">/help/</span><span style="background-color: #FFCCFF">index.jsp?topic</span><span style="background-color: #FFCCFF">=/</span><span style="background-color: #FFCCFF">com.arm.doc.faqs</span><span style="background-color: #FFCCFF">/ka3544.html</span></li>
|
|
||||||
<li>Beman: Some platforms (compiler/processor taken together) don't require
|
|
||||||
alignment for the conversion functions if code is inlined, although speed may
|
|
||||||
suffer. (test to verify this assertion). On those platforms, conversion
|
|
||||||
functions (perhaps in-place) can be used to implement unaligned integers.<ul>
|
|
||||||
<li>Microsoft <a href="http://msdn.microsoft.com/en-us/library/ms253978.aspx">
|
|
||||||
UNALIGNED / __unaligned</a> keywords for pointers. Also
|
|
||||||
<a href="http://msdn.microsoft.com/en-us/library/ms253935.aspx">Packing
|
|
||||||
Structures</a>.</li>
|
|
||||||
<li>GCC
|
|
||||||
<a href="http://www.mailinglistarchive.com/gcc@gcc.gnu.org/msg21079.html">
|
|
||||||
http://www.mailinglistarchive.com/gcc@gcc.gnu.org/msg21079.html</a></li>
|
|
||||||
<li>Intel performs well on simple unaligned test. See
|
|
||||||
<a href="../test/unaligned_test.cpp">../test/unaligned_test.cpp</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>Beman: Does the use of the unrolling templates get in the way of processor
|
|
||||||
specific optimization code?</li>
|
|
||||||
<li>Test use of endian integers with stream inserters and extractors.</li>
|
|
||||||
<li>Continue work on benchmarks and timings. Consider using use-case example
|
|
||||||
programs as benchmarks.</li>
|
|
||||||
<li dir="ltr">
|
|
||||||
<div class="im">
|
|
||||||
> The library should provide in addition endian conversion functions that
|
|
||||||
have<br>
|
|
||||||
> the endiannes as template parameters to make possible generic functions.</div>
|
|
||||||
<p dir="ltr">Compile time dispatch on an endianness enum was also requested in<br>
|
|
||||||
another review. That's fine with me, but I haven't had a chance to<br>
|
|
||||||
figure out the interface details.</li>
|
|
||||||
</ul>
|
|
||||||
<h3>Infrastructure</h3>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<div class="im">
|
|
||||||
> endian_operations_test.cpp and endian_in_union_test.cpp ... maybe rename
|
|
||||||
from<br>
|
|
||||||
> _test.cpp to _compile_test.cpp? they don't seem to do any run-time tests.
|
|
||||||
they<br>
|
|
||||||
> also should not include <cassert> since no assertion statement is needed,
|
|
||||||
this<br>
|
|
||||||
> might speed up the compilation time of the testsuite by something like
|
|
||||||
50ms ;)</div>
|
|
||||||
<p>Will do.</li>
|
|
||||||
<li>Make the bin() functionality available</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<p>* I'm only willing to provide conversion.hpp FP support. Providing<br>
|
|
||||||
types that mimic FP types is far beyond my knowledge of how to deal<br>
|
|
||||||
with floating point's notorious arithmetic issues.</p>
|
|
||||||
<p>Support IEEE754 format (32 bit, 64 bit) only.</p>
|
|
||||||
<hr>
|
<hr>
|
||||||
<p>Last revised:
|
<p>Last revised:
|
||||||
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->17 December, 2014<!--webbot bot="Timestamp" endspan i-checksum="38647" --></p>
|
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->17 January, 2015<!--webbot bot="Timestamp" endspan i-checksum="38899" --></p>
|
||||||
<p>© Copyright Beman Dawes, 2012</p>
|
<p>© Copyright Beman Dawes, 2012</p>
|
||||||
<p>Distributed under the Boost Software License, Version 1.0. See
|
<p>Distributed under the Boost Software License, Version 1.0. See
|
||||||
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
|
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
|
||||||
|
Reference in New Issue
Block a user