copy from develop

This commit is contained in:
Beman committed 2015-02-23 08:06:31 -05:00
1 parent a16b688654
commit ea0aa5280f
3 files changed
+307 -302

No files matched your search

+191 -186
View File
@@ -1,4 +1,4 @@
<html>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
@@ -86,19 +86,25 @@ endian</b></i> and <i><b>little endian</b></i>.</p>
<p>Boost endian integers provide the same full set of C++ assignment,
arithmetic, and relational operators&nbsp;as C++ standard integral types, with
the standard semantics.</p>
<p>Unary arithmetic operators are <code>+</code>, <code>-</code>, <code>~</code>,
<code>!</code>, prefix and postfix <code>--</code> and <code>++</code>. Binary
arithmetic operators are <code>+</code>, <code>+=</code>, <code>-</code>, <code>
-=</code>, <code>*</code>, <code>*=</code>, <code>/</code>, <code>/=</code>,
<code>%/ %=</code>, <code>&amp;</code>, <code>&amp;=</code>, <code>|</code>, <code>|=</code>,
<code>^</code>, <code>^=</code>, <code>&lt;&lt;</code>, <code>&lt;&lt;=</code>, <code>&gt;&gt;</code>,
<code>&gt;&gt;=</code>. Binary relational operators are <code>==</code>, <code>!=</code>,
<code>&lt;</code>, <code>&lt;=</code>, <code>&gt;</code>, <code>&gt;=</code>.</p>
<p>Automatic implicit conversion to the underlying value type is provided. A
conversion constructor from the underlying value type is provided. </p>
<p>Unary arithmetic operators are <b> <code><font face="Courier New">+</font></code></b>,
<b> <code>-</code></b>, <b> <code>~</code></b>, <b>
<code>!</code></b>, plus both prefix and postfix <b> <code>--</code></b> and <b> <code>++</code></b>. Binary
arithmetic operators are <b> <code>+</code></b>, <b> <code>+=</code></b>, <b> <code>-</code></b>,
<b> <code>
-=</code></b>, <b> <code>*</code></b>, <b> <code>*=</code></b>, <b> <code>/</code></b>,
<b> <code>/=</code></b>, <b> <code>&amp;</code></b>, <b> <code>&amp;=</code></b>,
<b> <code>|</code></b>, <b> <code>|=</code></b>, <b>
<code>^</code></b>, <b> <code>^=</code></b>, <b> <code>&lt;&lt;</code></b>, <b> <code>&lt;&lt;=</code></b>, <code>
<b>&gt;&gt;</b></code>, and <b>
<code>&gt;&gt;=</code></b>. Binary relational operators are <b> <code>==</code></b>,
<b> <code>!=</code></b>, <b>
<code>&lt;</code></b>, <b> <code>&lt;=</code></b>, <b> <code>&gt;</code></b>,
and <b> <code>&gt;=</code></b>.</p>
<p>Implicit conversion to the underlying value type is provided. An implicit
constructor converting from the underlying value type is provided. </p>
<h2><a name="Example">Example</a></h2>
<p>The <a href="../example/endian_example.cpp">endian_example.cpp</a> 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>
<pre>#include &lt;iostream&gt;
#include &lt;cstdio&gt;
@@ -128,10 +134,10 @@ namespace
int main(int, char* [])
{
BOOST_STATIC_ASSERT(sizeof(header) == 16U); // reality check
header h;
BOOST_STATIC_ASSERT(sizeof(h) == 16U); // reality check
h.file_code = 0x01020304;
h.file_length = sizeof(header);
h.version = 1;
@@ -181,14 +187,14 @@ is some other value, compilation will result in an <code>#error</code>. This
restriction is in place because the design, implementation, testing, and
documentation has only considered issues related to 8-bit bytes, and there have
been no real-world use cases presented for other sizes.</p>
<p>In C++03, <code>endian</code> does not meet the requirements for POD types
<p>In C++03, <code>endian_arithmetic</code> does not meet the requirements for POD types
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 <code>
problem in practice since all known C++ compilers lay out memory as if <code>
endian</code> were a POD type. In C++11, it is 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++11, <code>endian</code>
default constructor as trivial, and private data members and base classes no longer disqualify a type from being a POD
type. Thus under C++11, <code>endian_arithmetic</code>
will no longer be relying on unspecified behavior.</p>
<h2><a name="Feature-set">Feature set</a></h2>
<ul>
@@ -196,7 +202,7 @@ will no longer be relying on unspecified behavior.</p>
<li>Signed | unsigned</li>
<li>Unaligned | aligned</li>
<li>Integer | floating point</li>
<li>1-8 byte (unaligned) | 2, 4, 8 byte (aligned)</li>
<li>1-8 byte (unaligned) | 1, 2, 4, 8 byte (aligned)</li>
<li>Choice of value type</li>
</ul>
<h2>Enums and t<a name="Types">ypedefs</a></h2>
@@ -213,7 +219,7 @@ enum class align {no, yes}; </pre>
class endian_arithmetic;
</pre>
</blockquote>
<p>Typedefs, such as <code>big_int32_ut</code>, provide convenient naming
<p>Typedefs, such as <code>big_int32_t</code>, provide convenient naming
conventions for common use cases:</p>
<blockquote>
<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="49%">
@@ -225,112 +231,112 @@ conventions for common use cases:</p>
<td width="15%" align="center"><b><i>Sizes in bits (n)</i></b></td>
</tr>
<tr>
<td width="18%"><code>big_int</code><b><i>n</i></b><code>_ut</code></td>
<td width="18%"><code>big_int</code><b><i>n</i></b><code>_t</code></td>
<td width="49%" align="center"><code>no</code></td>
<td width="10%" align="center"><code>big</code></td>
<td width="10%" align="center">signed</td>
<td width="15%">8,16,24,32,40,48,56,64</td>
</tr>
<tr>
<td width="18%"><code>big_uint</code><i><b>n</b></i><code>_ut</code></td>
<td width="49%" align="center"><code>no</code></td>
<td width="10%" align="center"><code>big</code></td>
<td width="10%" align="center">unsigned</td>
<td width="15%">8,16,24,32,40,48,56,64</td>
</tr>
<tr>
<td width="18%"><code>big_float</code><i><b>n</b></i><code>_ut</code></td>
<td width="49%" align="center"><code>no</code></td>
<td width="10%" align="center"><code>big</code></td>
<td width="10%" align="center">signed</td>
<td width="15%">32,64</td>
</tr>
<tr>
<td width="18%"><code>little_int</code><i><b>n</b></i><code>_ut</code></td>
<td width="49%" align="center"><code>no</code></td>
<td width="10%" align="center"><code>little</code></td>
<td width="10%" align="center">signed</td>
<td width="15%">8,16,24,32,40,48,56,64</td>
</tr>
<tr>
<td width="18%"><code>little_uint</code><i><b>n</b></i><code>_ut</code></td>
<td width="49%" align="center"><code>no</code></td>
<td width="10%" align="center"><code>little</code></td>
<td width="10%" align="center">unsigned</td>
<td width="15%">8,16,24,32,40,48,56,64</td>
</tr>
<tr>
<td width="18%"><code>little_float</code><i><b>n</b></i><code>_ut</code></td>
<td width="49%" align="center"><code>no</code></td>
<td width="10%" align="center"><code>little</code></td>
<td width="10%" align="center">signed</td>
<td width="15%">32,64</td>
</tr>
<tr>
<td width="18%"><code>native_int</code><i><b>n</b></i><code>_ut</code></td>
<td width="49%" align="center"><code>no</code></td>
<td width="10%" align="center"><code>native</code></td>
<td width="10%" align="center">signed</td>
<td width="15%">8,16,24,32,40,48,56,64</td>
</tr>
<tr>
<td width="18%"><code>native_uint</code><i><b>n</b></i><code>_ut</code></td>
<td width="49%" align="center"><code>no</code></td>
<td width="10%" align="center"><code>native</code></td>
<td width="10%" align="center">unsigned</td>
<td width="15%">8,16,24,32,40,48,56,64</td>
</tr>
<tr>
<td width="18%"><code>native_float</code><i><b>n</b></i><code>_ut</code></td>
<td width="49%" align="center"><code>no</code></td>
<td width="10%" align="center"><code>native</code></td>
<td width="10%" align="center">signed</td>
<td width="15%">32,64</td>
</tr>
<tr>
<td width="18%"><code>big_int</code><i><b>n</b></i><code>_t</code></td>
<td width="49%" align="center"><code>yes</code></td>
<td width="10%" align="center"><code>big</code></td>
<td width="10%" align="center">signed</td>
<td width="15%">8,16,32,64</td>
</tr>
<tr>
<td width="18%"><code>big_uint</code><i><b>n</b></i><code>_t</code></td>
<td width="49%" align="center"><code>no</code></td>
<td width="10%" align="center"><code>big</code></td>
<td width="10%" align="center">unsigned</td>
<td width="15%">8,16,24,32,40,48,56,64</td>
</tr>
<tr>
<td width="18%"><code>big_float</code><i><b>n</b></i><code>_t</code></td>
<td width="49%" align="center"><code>no</code></td>
<td width="10%" align="center"><code>big</code></td>
<td width="10%" align="center">signed</td>
<td width="15%">32,64</td>
</tr>
<tr>
<td width="18%"><code>little_int</code><i><b>n</b></i><code>_t</code></td>
<td width="49%" align="center"><code>no</code></td>
<td width="10%" align="center"><code>little</code></td>
<td width="10%" align="center">signed</td>
<td width="15%">8,16,24,32,40,48,56,64</td>
</tr>
<tr>
<td width="18%"><code>little_uint</code><i><b>n</b></i><code>_t</code></td>
<td width="49%" align="center"><code>no</code></td>
<td width="10%" align="center"><code>little</code></td>
<td width="10%" align="center">unsigned</td>
<td width="15%">8,16,24,32,40,48,56,64</td>
</tr>
<tr>
<td width="18%"><code>little_float</code><i><b>n</b></i><code>_t</code></td>
<td width="49%" align="center"><code>no</code></td>
<td width="10%" align="center"><code>little</code></td>
<td width="10%" align="center">signed</td>
<td width="15%">32,64</td>
</tr>
<tr>
<td width="18%"><code>native_int</code><i><b>n</b></i><code>_t</code></td>
<td width="49%" align="center"><code>no</code></td>
<td width="10%" align="center"><code>native</code></td>
<td width="10%" align="center">signed</td>
<td width="15%">8,16,24,32,40,48,56,64</td>
</tr>
<tr>
<td width="18%"><code>native_uint</code><i><b>n</b></i><code>_t</code></td>
<td width="49%" align="center"><code>no</code></td>
<td width="10%" align="center"><code>native</code></td>
<td width="10%" align="center">unsigned</td>
<td width="15%">8,16,24,32,40,48,56,64</td>
</tr>
<tr>
<td width="18%"><code>native_float</code><i><b>n</b></i><code>_t</code></td>
<td width="49%" align="center"><code>no</code></td>
<td width="10%" align="center"><code>native</code></td>
<td width="10%" align="center">signed</td>
<td width="15%">32,64</td>
</tr>
<tr>
<td width="18%"><code>big_int</code><i><b>n</b></i><code>_at</code></td>
<td width="49%" align="center"><code>yes</code></td>
<td width="10%" align="center"><code>big</code></td>
<td width="10%" align="center">signed</td>
<td width="15%">8,16,32,64</td>
</tr>
<tr>
<td width="18%"><code>big_uint</code><i><b>n</b></i><code>_at</code></td>
<td width="49%" align="center"><code>yes</code></td>
<td width="10%" align="center"><code>big</code></td>
<td width="10%" align="center">unsigned</td>
<td width="15%">8,16,32,64</td>
</tr>
<tr>
<td width="18%"><code>big_float</code><i><b>n</b></i><code>_t</code></td>
<td width="18%"><code>big_float</code><i><b>n</b></i><code>_at</code></td>
<td width="49%" align="center"><code>yes</code></td>
<td width="10%" align="center"><code>big</code></td>
<td width="10%" align="center">signed</td>
<td width="15%">32,64</td>
</tr>
<tr>
<td width="18%" dir="ltr"><code>little_int</code><i><b>n</b></i><code>_t</code></td>
<td width="18%" dir="ltr"><code>little_int</code><i><b>n</b></i><code>_at</code></td>
<td width="49%" align="center" dir="ltr"><code>yes</code></td>
<td width="10%" align="center" dir="ltr"><code>little</code></td>
<td width="10%" align="center" dir="ltr">signed</td>
<td width="15%" dir="ltr">8,16,32,64</td>
</tr>
<tr>
<td width="18%" dir="ltr"><code>little_uint</code><i><b>n</b></i><code>_t</code></td>
<td width="18%" dir="ltr"><code>little_uint</code><i><b>n</b></i><code>_at</code></td>
<td width="49%" align="center" dir="ltr"><code>yes</code></td>
<td width="10%" align="center" dir="ltr"><code>little</code></td>
<td width="10%" align="center" dir="ltr">unsigned</td>
<td width="15%" dir="ltr">8,16,32,64</td>
</tr>
<tr>
<td width="18%" dir="ltr"><code>little_float</code><i><b>n</b></i><code>_t</code></td>
<td width="18%" dir="ltr"><code>little_float</code><i><b>n</b></i><code>_at</code></td>
<td width="49%" align="center" dir="ltr"><code>yes</code></td>
<td width="10%" align="center" dir="ltr"><code>little</code></td>
<td width="10%" align="center" dir="ltr">signed</td>
<td width="15%" dir="ltr">32,64</td>
</tr>
<tr>
<td width="18%"><code>native_float</code><i><b>n</b></i><code>_t</code></td>
<td width="18%"><code>native_float</code><i><b>n</b></i><code>_at</code></td>
<td width="49%" align="center"><code>yes</code></td>
<td width="10%" align="center"><code>native</code></td>
<td width="10%" align="center">signed</td>
@@ -347,14 +353,14 @@ requirements vary between hardware architectures and because alignment may be
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
are only available on architectures with 8, 16, 32, and 64-bit integer types.</p>
<p><i><b>Recommendation:</b></i> Prefer unaligned endian types.</p>
<p><i><b>Recommendation:</b></i> Prefer unaligned arithmetic types.</p>
<p><i><b>Recommendation:</b></i> Protect yourself against alignment ills. For
example:</p>
<blockquote>
<pre>static_assert(sizeof(containing_struct) == 12, &quot;sizeof(containing_struct) is wrong&quot;); </pre>
</blockquote>
<p><b><i>Note:</i></b> One-byte big and little buffer types
never actually reverse endianness. They are provided to enable generic code, and
<p><b><i>Note:</i></b> <b><i>Note:</i></b> One-byte arithmetic types
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.</p>
<h2><a name="Class_template_endian">Class template <code>endian</code></a><code>_arithmetic</code></h2>
<p>An endian is an integer byte-holder with user-specified <a href="#endianness">
@@ -427,109 +433,109 @@ usual operations on integers are supplied.</p>
// typedefs
// aligned big endian floating point types
typedef endian&lt;order::big, float, 32, align::yes&gt; big_float32_t;
typedef endian&lt;order::big, double, 64, align::yes&gt; big_float64_t;
// aligned little endian floating point types
typedef endian&lt;order::little, float, 32, align::yes&gt; little_float32_t;
typedef endian&lt;order::little, double, 64, align::yes&gt; little_float64_t;
// unaligned big endian signed integer types
typedef endian&lt;order::big, int_least8_t, 8&gt; big_int8_t;
typedef endian&lt;order::big, int_least16_t, 16&gt; big_int16_t;
typedef endian&lt;order::big, int_least32_t, 24&gt; big_int24_t;
typedef endian&lt;order::big, int_least32_t, 32&gt; big_int32_t;
typedef endian&lt;order::big, int_least64_t, 40&gt; big_int40_t;
typedef endian&lt;order::big, int_least64_t, 48&gt; big_int48_t;
typedef endian&lt;order::big, int_least64_t, 56&gt; big_int56_t;
typedef endian&lt;order::big, int_least64_t, 64&gt; big_int64_t;
// unaligned big endian unsigned integer types
typedef endian&lt;order::big, uint_least8_t, 8&gt; big_uint8_t;
typedef endian&lt;order::big, uint_least16_t, 16&gt; big_uint16_t;
typedef endian&lt;order::big, uint_least32_t, 24&gt; big_uint24_t;
typedef endian&lt;order::big, uint_least32_t, 32&gt; big_uint32_t;
typedef endian&lt;order::big, uint_least64_t, 40&gt; big_uint40_t;
typedef endian&lt;order::big, uint_least64_t, 48&gt; big_uint48_t;
typedef endian&lt;order::big, uint_least64_t, 56&gt; big_uint56_t;
typedef endian&lt;order::big, uint_least64_t, 64&gt; big_uint64_t;
// unaligned big endian floating point types
typedef endian&lt;order::big, float, 32, align::no&gt; big_float32_ut;
typedef endian&lt;order::big, double, 64, align::no&gt; big_float64_ut;
typedef endian&lt;order::big, float, 32&gt; big_float32_t;
typedef endian&lt;order::big, double, 64&gt; big_float64_t;
// unaligned little endian signed integer types
typedef endian&lt;order::little, int_least8_t, 8&gt; little_int8_t;
typedef endian&lt;order::little, int_least16_t, 16&gt; little_int16_t;
typedef endian&lt;order::little, int_least32_t, 24&gt; little_int24_t;
typedef endian&lt;order::little, int_least32_t, 32&gt; little_int32_t;
typedef endian&lt;order::little, int_least64_t, 40&gt; little_int40_t;
typedef endian&lt;order::little, int_least64_t, 48&gt; little_int48_t;
typedef endian&lt;order::little, int_least64_t, 56&gt; little_int56_t;
typedef endian&lt;order::little, int_least64_t, 64&gt; little_int64_t;
// unaligned little endian unsigned integer types
typedef endian&lt;order::little, uint_least8_t, 8&gt; little_uint8_t;
typedef endian&lt;order::little, uint_least16_t, 16&gt; little_uint16_t;
typedef endian&lt;order::little, uint_least32_t, 24&gt; little_uint24_t;
typedef endian&lt;order::little, uint_least32_t, 32&gt; little_uint32_t;
typedef endian&lt;order::little, uint_least64_t, 40&gt; little_uint40_t;
typedef endian&lt;order::little, uint_least64_t, 48&gt; little_uint48_t;
typedef endian&lt;order::little, uint_least64_t, 56&gt; little_uint56_t;
typedef endian&lt;order::little, uint_least64_t, 64&gt; little_uint64_t;
// unaligned little endian floating point types
typedef endian&lt;order::little, float, 32, align::no&gt; little_float32_ut;
typedef endian&lt;order::little, double, 64, align::no&gt; little_float64_ut;
typedef endian&lt;order::little, float, 32, align::no&gt; little_float32_t;
typedef endian&lt;order::little, double, 64, align::no&gt; little_float64_t;
// unaligned native endian signed integer types
typedef <b><i>implementation-defined</i></b>_int8_t native_int8_t;
typedef <b><i>implementation-defined</i></b>_int16_t native_int16_t;
typedef <b><i>implementation-defined</i></b>_int24_t native_int24_t;
typedef <b><i>implementation-defined</i></b>_int32_t native_int32_t;
typedef <b><i>implementation-defined</i></b>_int40_t native_int40_t;
typedef <b><i>implementation-defined</i></b>_int48_t native_int48_t;
typedef <b><i>implementation-defined</i></b>_int56_t native_int56_t;
typedef <b><i>implementation-defined</i></b>_int64_t native_int64_t;
// unaligned native endian unsigned integer types
typedef <b><i>implementation-defined</i></b>_uint8_t native_uint8_t;
typedef <b><i>implementation-defined</i></b>_uint16_t native_uint16_t;
typedef <b><i>implementation-defined</i></b>_uint24_t native_uint24_t;
typedef <b><i>implementation-defined</i></b>_uint32_t native_uint32_t;
typedef <b><i>implementation-defined</i></b>_uint40_t native_uint40_t;
typedef <b><i>implementation-defined</i></b>_uint48_t native_uint48_t;
typedef <b><i>implementation-defined</i></b>_uint56_t native_uint56_t;
typedef <b><i>implementation-defined</i></b>_uint64_t native_uint64_t;
// aligned big endian signed integer types
typedef endian&lt;order::big, int8_t, 8, align::yes&gt; big_int8_t;
typedef endian&lt;order::big, int16_t, 16, align::yes&gt; big_int16_t;
typedef endian&lt;order::big, int32_t, 32, align::yes&gt; big_int32_t;
typedef endian&lt;order::big, int64_t, 64, align::yes&gt; big_int64_t;
typedef endian&lt;order::big, int8_t, 8, align::yes&gt; big_int8_at;
typedef endian&lt;order::big, int16_t, 16, align::yes&gt; big_int16_at;
typedef endian&lt;order::big, int32_t, 32, align::yes&gt; big_int32_at;
typedef endian&lt;order::big, int64_t, 64, align::yes&gt; big_int64_at;
// aligned big endian unsigned integer types
typedef endian&lt;order::big, uint8_t, 8, align::yes&gt; big_uint8_t;
typedef endian&lt;order::big, uint16_t, 16, align::yes&gt; big_uint16_t;
typedef endian&lt;order::big, uint32_t, 32, align::yes&gt; big_uint32_t;
typedef endian&lt;order::big, uint64_t, 64, align::yes&gt; big_uint64_t;
typedef endian&lt;order::big, uint8_t, 8, align::yes&gt; big_uint8_at;
typedef endian&lt;order::big, uint16_t, 16, align::yes&gt; big_uint16_at;
typedef endian&lt;order::big, uint32_t, 32, align::yes&gt; big_uint32_at;
typedef endian&lt;order::big, uint64_t, 64, align::yes&gt; big_uint64_at;
// aligned big endian floating point types
typedef endian&lt;order::big, float, 32, align::yes&gt; big_float32_at;
typedef endian&lt;order::big, double, 64, align::yes&gt; big_float64_at;
// aligned little endian signed integer types
typedef endian&lt;order::little, int8_t, 8, align::yes&gt; little_int8_t;
typedef endian&lt;order::little, int16_t, 16, align::yes&gt; little_int16_t;
typedef endian&lt;order::little, int32_t, 32, align::yes&gt; little_int32_t;
typedef endian&lt;order::little, int64_t, 64, align::yes&gt; little_int64_t;
typedef endian&lt;order::little, int8_t, 8, align::yes&gt; little_int8_at;
typedef endian&lt;order::little, int16_t, 16, align::yes&gt; little_int16_at;
typedef endian&lt;order::little, int32_t, 32, align::yes&gt; little_int32_at;
typedef endian&lt;order::little, int64_t, 64, align::yes&gt; little_int64_at;
// aligned little endian unsigned integer types
typedef endian&lt;order::little, uint8_t, 8, align::yes&gt; little_uint8_t;
typedef endian&lt;order::little, uint16_t, 16, align::yes&gt; little_uint16_t;
typedef endian&lt;order::little, uint32_t, 32, align::yes&gt; little_uint32_t;
typedef endian&lt;order::little, uint64_t, 64, align::yes&gt; little_uint64_t;
typedef endian&lt;order::little, uint8_t, 8, align::yes&gt; little_uint8_at;
typedef endian&lt;order::little, uint16_t, 16, align::yes&gt; little_uint16_at;
typedef endian&lt;order::little, uint32_t, 32, align::yes&gt; little_uint32_at;
typedef endian&lt;order::little, uint64_t, 64, align::yes&gt; little_uint64_at;
// aligned little endian floating point types
typedef endian&lt;order::little, float, 32, align::yes&gt; little_float32_at;
typedef endian&lt;order::little, double, 64, align::yes&gt; little_float64_at;
// aligned native endian typedefs are not provided because
// &lt;cstdint&gt; types are superior for that use case
// unaligned big endian signed integer types
typedef endian&lt;order::big, int_least8_t, 8&gt; big_int8_ut;
typedef endian&lt;order::big, int_least16_t, 16&gt; big_int16_ut;
typedef endian&lt;order::big, int_least32_t, 24&gt; big_int24_ut;
typedef endian&lt;order::big, int_least32_t, 32&gt; big_int32_ut;
typedef endian&lt;order::big, int_least64_t, 40&gt; big_int40_ut;
typedef endian&lt;order::big, int_least64_t, 48&gt; big_int48_ut;
typedef endian&lt;order::big, int_least64_t, 56&gt; big_int56_ut;
typedef endian&lt;order::big, int_least64_t, 64&gt; big_int64_ut;
// unaligned big endian unsigned integer types
typedef endian&lt;order::big, uint_least8_t, 8&gt; big_uint8_ut;
typedef endian&lt;order::big, uint_least16_t, 16&gt; big_uint16_ut;
typedef endian&lt;order::big, uint_least32_t, 24&gt; big_uint24_ut;
typedef endian&lt;order::big, uint_least32_t, 32&gt; big_uint32_ut;
typedef endian&lt;order::big, uint_least64_t, 40&gt; big_uint40_ut;
typedef endian&lt;order::big, uint_least64_t, 48&gt; big_uint48_ut;
typedef endian&lt;order::big, uint_least64_t, 56&gt; big_uint56_ut;
typedef endian&lt;order::big, uint_least64_t, 64&gt; big_uint64_ut;
// unaligned little endian signed integer types
typedef endian&lt;order::little, int_least8_t, 8&gt; little_int8_ut;
typedef endian&lt;order::little, int_least16_t, 16&gt; little_int16_ut;
typedef endian&lt;order::little, int_least32_t, 24&gt; little_int24_ut;
typedef endian&lt;order::little, int_least32_t, 32&gt; little_int32_ut;
typedef endian&lt;order::little, int_least64_t, 40&gt; little_int40_ut;
typedef endian&lt;order::little, int_least64_t, 48&gt; little_int48_ut;
typedef endian&lt;order::little, int_least64_t, 56&gt; little_int56_ut;
typedef endian&lt;order::little, int_least64_t, 64&gt; little_int64_ut;
// unaligned little endian unsigned integer types
typedef endian&lt;order::little, uint_least8_t, 8&gt; little_uint8_ut;
typedef endian&lt;order::little, uint_least16_t, 16&gt; little_uint16_ut;
typedef endian&lt;order::little, uint_least32_t, 24&gt; little_uint24_ut;
typedef endian&lt;order::little, uint_least32_t, 32&gt; little_uint32_ut;
typedef endian&lt;order::little, uint_least64_t, 40&gt; little_uint40_ut;
typedef endian&lt;order::little, uint_least64_t, 48&gt; little_uint48_ut;
typedef endian&lt;order::little, uint_least64_t, 56&gt; little_uint56_ut;
typedef endian&lt;order::little, uint_least64_t, 64&gt; little_uint64_ut;
// unaligned native endian signed integer types
typedef <b><i>implementation-defined</i></b>_int8_t native_int8_ut;
typedef <b><i>implementation-defined</i></b>_int16_t native_int16_ut;
typedef <b><i>implementation-defined</i></b>_int24_t native_int24_ut;
typedef <b><i>implementation-defined</i></b>_int32_t native_int32_ut;
typedef <b><i>implementation-defined</i></b>_int40_t native_int40_ut;
typedef <b><i>implementation-defined</i></b>_int48_t native_int48_ut;
typedef <b><i>implementation-defined</i></b>_int56_t native_int56_ut;
typedef <b><i>implementation-defined</i></b>_int64_t native_int64_ut;
// unaligned native endian unsigned integer types
typedef <b><i>implementation-defined</i></b>_uint8_t native_uint8_ut;
typedef <b><i>implementation-defined</i></b>_uint16_t native_uint16_ut;
typedef <b><i>implementation-defined</i></b>_uint24_t native_uint24_ut;
typedef <b><i>implementation-defined</i></b>_uint32_t native_uint32_ut;
typedef <b><i>implementation-defined</i></b>_uint40_t native_uint40_ut;
typedef <b><i>implementation-defined</i></b>_uint48_t native_uint48_ut;
typedef <b><i>implementation-defined</i></b>_uint56_t native_uint56_ut;
typedef <b><i>implementation-defined</i></b>_uint64_t native_uint64_ut;
} // namespace endian
} // namespace boost</pre>
<p>The <i><b><code>implementation-defined</code></b></i> text above is either
@@ -540,11 +546,11 @@ platform.</p>
<pre><code><a name="endian">endian</a>() = default; // C++03: endian(){}</code></pre>
</div>
<blockquote>
<p><i>Effects:</i> Constructs an object of type <code>endian&lt;E, T, n_bits, A&gt;</code>.</p>
<p><i>Effects:</i> Constructs an uninitialized object of type <code>endian_arithmetic&lt;E, T, n_bits, A&gt;</code>.</p>
</blockquote>
<pre><code><a name="explicit-endian">endian</a>(T v);</code></pre>
<blockquote>
<p><i>Effects:</i> Constructs an object of type <code>endian&lt;E, T, n_bits, A&gt;</code>.</p>
<p><i>Effects:</i> Constructs an object of type <code>endian_arithmetic&lt;E, T, n_bits, A&gt;</code>.</p>
<p><i>Postcondition:</i> <code>x == v,</code> where <code>x</code> is the
constructed object.</p>
</blockquote>
@@ -613,8 +619,7 @@ programming.</p>
<p><b>Why bother with the aligned endian types?</b> Aligned integer operations
may be faster (as much as 10 to 20 times faster) if the endianness and alignment of
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.</p>
however, will be somewhat less portable than with the unaligned types.</p>
<p><b>Why provide the arithmetic operations?</b> 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:</p>
@@ -688,7 +693,7 @@ differs from endian representation size. Vicente Botet and other reviewers
suggested supporting floating point types.</p>
<hr>
<p>Last revised:
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->17 February, 2015<!--webbot bot="Timestamp" endspan i-checksum="40541" --></p>
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->23 February, 2015<!--webbot bot="Timestamp" endspan i-checksum="40534" --></p>
<p>© Copyright Beman Dawes, 2006-2009, 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>