mirror of
https://github.com/boostorg/endian.git
synced 2025-07-31 13:07:24 +02:00
Rename unaligned integers to fit the floating point pattern. Unifies the naming pattern, deliberately makes the unaligned type names a bit uglier.
This commit is contained in:
@ -12,33 +12,38 @@
|
||||
|
||||
<h1>Endian changes since formal review</h1>
|
||||
<ul>
|
||||
<li>Headers rename to endian/types.hpp and endian/conversion.hpp.
|
||||
Infrastructure file names changed accordingly.</li>
|
||||
<li>The conversion.hpp conversion functions have been much revised, refactored,
|
||||
renamed and otherwise improved based on review comments.<ul>
|
||||
<li>UDT's are supported.</li>
|
||||
<li><code>float</code>(32-bits) and <code>double</code> (64-bits) are
|
||||
supported.</li>
|
||||
<li>Both return-by-value and modify-in-place interfaces are provided.</li>
|
||||
<li>Both the endian types and endian conversion functions now support 32-bit (<code>float)</code> and
|
||||
64-bit <code>(double)</code> floating point, as requested.</li>
|
||||
<li>Both the endian types and endian conversion functions have been renamed,
|
||||
using a naming pattern that is consistent for both integer and floating point,
|
||||
and that emphasizes that aligned types are usually preferred compared to
|
||||
unaligned types.</li>
|
||||
<li>The conversion.hpp conversion functions have been much revised,
|
||||
refactored, and otherwise improved based on review comments.<ul>
|
||||
<li>UDT's are supported, as requested.</li>
|
||||
<li>Both return-by-value and modify-in-place interfaces are provided, as
|
||||
requested.</li>
|
||||
<li>Synonyms for the BSD byte swapping function names popularized by OS X
|
||||
and Linux are provided, so that that developers already used to these name
|
||||
can continue to use them if they wish.</li>
|
||||
<li>In addition to the fixed endianness functions, functions that perform
|
||||
compile-time (via template) and run-time (via function argument) dispatch
|
||||
are now provided.</li>
|
||||
are now provided, as requested.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Compiler (Clang, GCC, VisualC++, etc.) intrinsics and built-in functions
|
||||
are used in the implementation where appropriate.</li>
|
||||
<li>For the aligned endian integer types, the implementation uses
|
||||
conversion.hpp conversion functions.</li>
|
||||
<li>C++11 features such as <code>noexcept</code> are used, while still
|
||||
are used in the implementation where appropriate, as requested.</li>
|
||||
<li>For the endian types, the implementation uses the endian conversion functions,
|
||||
as requested.</li>
|
||||
<li>Headers have been renamed to endian/types.hpp and endian/conversion.hpp.
|
||||
Infrastructure file names changed accordingly.</li>
|
||||
<li>C++11 features such as <code>noexcept</code> are now used, while still
|
||||
supporting C++03 compilers.</li>
|
||||
<li>Acknowledgements have been updated.</li>
|
||||
<li>Headers have been reorganized to make them easier to read, as requested,
|
||||
with a synopsis at the front and implementation following.</li>
|
||||
<li>Headers have been reorganized to make them easier to read,
|
||||
with a synopsis at the front and implementation following, as requested.</li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
237
doc/types.html
237
doc/types.html
@ -192,8 +192,9 @@ will no longer be relying on unspecified behavior.</p>
|
||||
<li>Big endian| little endian | native endian byte ordering.</li>
|
||||
<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>Choice of integer value type</li>
|
||||
<li>Choice of value type</li>
|
||||
</ul>
|
||||
<h2>Enums and t<a name="Types">ypedefs</a></h2>
|
||||
<p>Two scoped enums are provided:</p>
|
||||
@ -232,6 +233,13 @@ conventions for common use cases:</p>
|
||||
<td width="15%">16,32,64</td>
|
||||
<td width="49%" align="center"><code>yes</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="18%"><code>big_float</code><i><b>n</b></i><code>_t</code></td>
|
||||
<td width="10%" align="center"><code>big</code></td>
|
||||
<td width="10%" align="center">signed</td>
|
||||
<td width="15%">32,64</td>
|
||||
<td width="49%" align="center"><code>yes</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="18%"><code>little_int</code><i><b>n</b></i><code>_t</code></td>
|
||||
<td width="10%" align="center"><code>little</code></td>
|
||||
@ -247,42 +255,63 @@ conventions for common use cases:</p>
|
||||
<td width="49%" align="center"><code>yes</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="18%"><code>big_</code><b><i>n</i></b><code>_t</code></td>
|
||||
<td width="18%"><code>little_float</code><i><b>n</b></i><code>_t</code></td>
|
||||
<td width="10%" align="center"><code>little</code></td>
|
||||
<td width="10%" align="center">signed</td>
|
||||
<td width="15%">32,64</td>
|
||||
<td width="49%" align="center"><code>yes</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="18%"><code>big_int</code><b><i>n</i></b><code>un_t</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>
|
||||
<td width="49%" align="center"><code>no</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="18%"><code>big_u</code><i><b>n</b></i><code>_t</code></td>
|
||||
<td width="18%"><code>big_uint</code><i><b>n</b></i><code>un_</code><code>t</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>
|
||||
<td width="49%" align="center"><code>no</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="18%"><code>little_</code><i><b>n</b></i><code>_t</code></td>
|
||||
<td width="18%"><code>big_float</code><i><b>n</b></i><code>un_t</code></td>
|
||||
<td width="10%" align="center"><code>big</code></td>
|
||||
<td width="10%" align="center">signed</td>
|
||||
<td width="15%">32,64</td>
|
||||
<td width="49%" align="center"><code>no</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="18%"><code>little_int</code><i><b>n</b></i><code>un_</code><code>t</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>
|
||||
<td width="49%" align="center"><code>no</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="18%"><code>little_u</code><i><b>n</b></i><code>_t</code></td>
|
||||
<td width="18%"><code>little_uint</code><i><b>n</b></i><code>un_</code><code>t</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>
|
||||
<td width="49%" align="center"><code>no</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="18%"><code>native_</code><i><b>n</b></i><code>_t</code></td>
|
||||
<td width="18%"><code>little_float</code><i><b>n</b></i><code>un_t</code></td>
|
||||
<td width="10%" align="center"><code>little</code></td>
|
||||
<td width="10%" align="center">signed</td>
|
||||
<td width="15%">32,64</td>
|
||||
<td width="49%" align="center"><code>no</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="18%"><code>native_int</code><i><b>n</b></i><code>un_</code><code>t</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>
|
||||
<td width="49%" align="center"><code>no</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="18%"><code>native_u</code><i><b>n</b></i><code>_t</code></td>
|
||||
<td width="18%"><code>native_uint</code><i><b>n</b></i><code>un_</code><code>t</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>
|
||||
@ -294,27 +323,13 @@ conventions for common use cases:</p>
|
||||
and structs. This is an important characteristic that can be exploited to minimize wasted space in
|
||||
memory, files, and network transmissions. </p>
|
||||
<p><font color="#FF0000"><b><i><span style="background-color: #FFFFFF">Warning:</span></i></b></font><span style="background-color: #FFFFFF">
|
||||
Code that uses a</span>ligned types is inherently non-portable because alignment
|
||||
Code that uses a</span>ligned types is possibly non-portable because alignment
|
||||
requirements vary between hardware architectures and because alignment may be
|
||||
affected by compiler switches or pragmas. Furthermore, aligned types
|
||||
are only available on architectures with 16, 32, and 64-bit integer types.</p>
|
||||
<p><b><i>Note:</i></b> One-byte big-endian, little-endian, and native-endian types
|
||||
<p><b><i>Note:</i></b> One-byte types
|
||||
have identical
|
||||
functionality. They are provided to improve code readability and searchability.</p>
|
||||
<h3><a name="Comment-on-naming">Comment on naming</a></h3>
|
||||
<p>When first exposed to endian types, programmers often fit them into a mental model
|
||||
based on the <code><cstdint></code> types. Using that model, it is natural to
|
||||
expect a 56-bit big-endian signed integer to be named <code>int_big56_t</code>
|
||||
rather than <code>big56_t</code>.</p>
|
||||
<p>As experience using these type grows, the realization creeps in that they are
|
||||
lousy arithmetic integers - they are really byte holders that for convenience
|
||||
support arithmetic operations - and for use in internal interfaces or
|
||||
anything more than trivial arithmetic computations it is far better to convert
|
||||
values of these endian types to traditional integer types.</p>
|
||||
<p>That seems to lead to formation of a new mental model specific to endian byte-holder types. In that model, the endianness
|
||||
is the key feature, and the integer aspect is downplayed.
|
||||
Once that mental transition is made, a name like <code>big56_t</code> is a good
|
||||
reflection of the mental model</p>
|
||||
<h2><a name="Class_template_endian">Class template <code>endian</code></a></h2>
|
||||
<p>An endian is an integer byte-holder with user-specified <a href="#endianness">
|
||||
endianness</a>, value type, size, and <a href="#alignment">alignment</a>. The
|
||||
@ -364,88 +379,103 @@ usual operations on integers are supplied.</p>
|
||||
endian operator--(endian& x, int) noexcept;
|
||||
};
|
||||
|
||||
typedef endian<order::big, float, 32, align::yes> big_float32_t;
|
||||
typedef endian<order::big, double, 64, align::yes> big_float64_t;
|
||||
|
||||
// aligned little endian floating point types
|
||||
typedef endian<order::little, float, 32, align::yes> little_float32_t;
|
||||
typedef endian<order::little, double, 64, align::yes> little_float64_t;
|
||||
|
||||
// unaligned big endian floating point types
|
||||
typedef endian<order::big, float, 32, align::no> big_float32un_t;
|
||||
typedef endian<order::big, double, 64, align::no> big_float64un_t;
|
||||
|
||||
// unaligned little endian floating point types
|
||||
typedef endian<order::little, float, 32, align::no> little_float32un_t;
|
||||
typedef endian<order::little, double, 64, align::no> little_float64un_t;
|
||||
|
||||
// aligned big endian signed integer types
|
||||
typedef endian<order::big, int16_t, 16, align::yes> big_int16_t;
|
||||
typedef endian<order::big, int32_t, 32, align::yes> big_int32_t;
|
||||
typedef endian<order::big, int64_t, 64, align::yes> big_int64_t;
|
||||
|
||||
typedef endian<order::big, int16_t, 16, align::yes> big_int16_t;
|
||||
typedef endian<order::big, int32_t, 32, align::yes> big_int32_t;
|
||||
typedef endian<order::big, int64_t, 64, align::yes> big_int64_t;
|
||||
|
||||
// aligned big endian unsigned integer types
|
||||
typedef endian<order::big, uint16_t, 16, align::yes> big_uint16_t;
|
||||
typedef endian<order::big, uint32_t, 32, align::yes> big_uint32_t;
|
||||
typedef endian<order::big, uint64_t, 64, align::yes> big_uint64_t;
|
||||
|
||||
typedef endian<order::big, uint16_t, 16, align::yes> big_uint16_t;
|
||||
typedef endian<order::big, uint32_t, 32, align::yes> big_uint32_t;
|
||||
typedef endian<order::big, uint64_t, 64, align::yes> big_uint64_t;
|
||||
|
||||
// aligned little endian signed integer types
|
||||
typedef endian<order::little, int16_t, 16, align::yes> little_int16_t;
|
||||
typedef endian<order::little, int32_t, 32, align::yes> little_int32_t;
|
||||
typedef endian<order::little, int64_t, 64, align::yes> little_int64_t;
|
||||
|
||||
typedef endian<order::little, int16_t, 16, align::yes> little_int16_t;
|
||||
typedef endian<order::little, int32_t, 32, align::yes> little_int32_t;
|
||||
typedef endian<order::little, int64_t, 64, align::yes> little_int64_t;
|
||||
|
||||
// aligned little endian unsigned integer types
|
||||
typedef endian<order::little, uint16_t, 16, align::yes> little_uint16_t;
|
||||
typedef endian<order::little, uint32_t, 32, align::yes> little_uint32_t;
|
||||
typedef endian<order::little, uint64_t, 64, align::yes> little_uint64_t;
|
||||
|
||||
typedef endian<order::little, uint16_t, 16, align::yes> little_uint16_t;
|
||||
typedef endian<order::little, uint32_t, 32, align::yes> little_uint32_t;
|
||||
typedef endian<order::little, uint64_t, 64, align::yes> little_uint64_t;
|
||||
|
||||
// aligned native endian typedefs are not provided because
|
||||
// <cstdint> types are superior for this use case
|
||||
|
||||
|
||||
// unaligned big endian signed integer types
|
||||
typedef endian<order::big, int_least8_t, 8> big_8_t;
|
||||
typedef endian<order::big, int_least16_t, 16> big_16_t;
|
||||
typedef endian<order::big, int_least32_t, 24> big_24_t;
|
||||
typedef endian<order::big, int_least32_t, 32> big_32_t;
|
||||
typedef endian<order::big, int_least64_t, 40> big_40_t;
|
||||
typedef endian<order::big, int_least64_t, 48> big_48_t;
|
||||
typedef endian<order::big, int_least64_t, 56> big_56_t;
|
||||
typedef endian<order::big, int_least64_t, 64> big_64_t;
|
||||
|
||||
typedef endian<order::big, int_least8_t, 8> big_int8un_t;
|
||||
typedef endian<order::big, int_least16_t, 16> big_int16un_t;
|
||||
typedef endian<order::big, int_least32_t, 24> big_int24un_t;
|
||||
typedef endian<order::big, int_least32_t, 32> big_int32un_t;
|
||||
typedef endian<order::big, int_least64_t, 40> big_int40un_t;
|
||||
typedef endian<order::big, int_least64_t, 48> big_int48un_t;
|
||||
typedef endian<order::big, int_least64_t, 56> big_int56un_t;
|
||||
typedef endian<order::big, int_least64_t, 64> big_int64un_t;
|
||||
|
||||
// unaligned big endian unsigned integer types
|
||||
typedef endian<order::big, uint_least8_t, 8> big_u8_t;
|
||||
typedef endian<order::big, uint_least16_t, 16> big_u16_t;
|
||||
typedef endian<order::big, uint_least32_t, 24> big_u24_t;
|
||||
typedef endian<order::big, uint_least32_t, 32> big_u32_t;
|
||||
typedef endian<order::big, uint_least64_t, 40> big_u40_t;
|
||||
typedef endian<order::big, uint_least64_t, 48> big_u48_t;
|
||||
typedef endian<order::big, uint_least64_t, 56> big_u56_t;
|
||||
typedef endian<order::big, uint_least64_t, 64> big_u64_t;
|
||||
|
||||
typedef endian<order::big, uint_least8_t, 8> big_uint8un_t;
|
||||
typedef endian<order::big, uint_least16_t, 16> big_uint16un_t;
|
||||
typedef endian<order::big, uint_least32_t, 24> big_uint24un_t;
|
||||
typedef endian<order::big, uint_least32_t, 32> big_uint32un_t;
|
||||
typedef endian<order::big, uint_least64_t, 40> big_uint40un_t;
|
||||
typedef endian<order::big, uint_least64_t, 48> big_uint48un_t;
|
||||
typedef endian<order::big, uint_least64_t, 56> big_uint56un_t;
|
||||
typedef endian<order::big, uint_least64_t, 64> big_uint64un_t;
|
||||
|
||||
// unaligned little endian signed integer types
|
||||
typedef endian<order::little, int_least8_t, 8> little_8_t;
|
||||
typedef endian<order::little, int_least16_t, 16> little_16_t;
|
||||
typedef endian<order::little, int_least32_t, 24> little_24_t;
|
||||
typedef endian<order::little, int_least32_t, 32> little_32_t;
|
||||
typedef endian<order::little, int_least64_t, 40> little_40_t;
|
||||
typedef endian<order::little, int_least64_t, 48> little_48_t;
|
||||
typedef endian<order::little, int_least64_t, 56> little_56_t;
|
||||
typedef endian<order::little, int_least64_t, 64> little_64_t;
|
||||
|
||||
typedef endian<order::little, int_least8_t, 8> little_int8un_t;
|
||||
typedef endian<order::little, int_least16_t, 16> little_int16un_t;
|
||||
typedef endian<order::little, int_least32_t, 24> little_int24un_t;
|
||||
typedef endian<order::little, int_least32_t, 32> little_int32un_t;
|
||||
typedef endian<order::little, int_least64_t, 40> little_int40un_t;
|
||||
typedef endian<order::little, int_least64_t, 48> little_int48un_t;
|
||||
typedef endian<order::little, int_least64_t, 56> little_int56un_t;
|
||||
typedef endian<order::little, int_least64_t, 64> little_int64un_t;
|
||||
|
||||
// unaligned little endian unsigned integer types
|
||||
typedef endian<order::little, uint_least8_t, 8> little_u8_t;
|
||||
typedef endian<order::little, uint_least16_t, 16> little_u16_t;
|
||||
typedef endian<order::little, uint_least32_t, 24> little_u24_t;
|
||||
typedef endian<order::little, uint_least32_t, 32> little_u32_t;
|
||||
typedef endian<order::little, uint_least64_t, 40> little_u40_t;
|
||||
typedef endian<order::little, uint_least64_t, 48> little_u48_t;
|
||||
typedef endian<order::little, uint_least64_t, 56> little_u56_t;
|
||||
typedef endian<order::little, uint_least64_t, 64> little_u64_t;
|
||||
|
||||
typedef endian<order::little, uint_least8_t, 8> little_uint8un_t;
|
||||
typedef endian<order::little, uint_least16_t, 16> little_uint16un_t;
|
||||
typedef endian<order::little, uint_least32_t, 24> little_uint24un_t;
|
||||
typedef endian<order::little, uint_least32_t, 32> little_uint32un_t;
|
||||
typedef endian<order::little, uint_least64_t, 40> little_uint40un_t;
|
||||
typedef endian<order::little, uint_least64_t, 48> little_uint48un_t;
|
||||
typedef endian<order::little, uint_least64_t, 56> little_uint56un_t;
|
||||
typedef endian<order::little, uint_least64_t, 64> little_uint64un_t;
|
||||
|
||||
// unaligned native endian signed integer types
|
||||
typedef endian<order::native, int_least8_t, 8> native_8_t;
|
||||
typedef endian<order::native, int_least16_t, 16> native_16_t;
|
||||
typedef endian<order::native, int_least32_t, 24> native_24_t;
|
||||
typedef endian<order::native, int_least32_t, 32> native_32_t;
|
||||
typedef endian<order::native, int_least64_t, 40> native_40_t;
|
||||
typedef endian<order::native, int_least64_t, 48> native_48_t;
|
||||
typedef endian<order::native, int_least64_t, 56> native_56_t;
|
||||
typedef endian<order::native, int_least64_t, 64> native_64_t;
|
||||
|
||||
typedef endian<order::native, int_least8_t, 8> native_int8un_t;
|
||||
typedef endian<order::native, int_least16_t, 16> native_int16un_t;
|
||||
typedef endian<order::native, int_least32_t, 24> native_int24un_t;
|
||||
typedef endian<order::native, int_least32_t, 32> native_int32un_t;
|
||||
typedef endian<order::native, int_least64_t, 40> native_int40un_t;
|
||||
typedef endian<order::native, int_least64_t, 48> native_int48un_t;
|
||||
typedef endian<order::native, int_least64_t, 56> native_int56un_t;
|
||||
typedef endian<order::native, int_least64_t, 64> native_int64un_t;
|
||||
|
||||
// unaligned native endian unsigned integer types
|
||||
typedef endian<order::native, uint_least8_t, 8> native_u8_t;
|
||||
typedef endian<order::native, uint_least16_t, 16> native_u16_t;
|
||||
typedef endian<order::native, uint_least32_t, 24> native_u24_t;
|
||||
typedef endian<order::native, uint_least32_t, 32> native_u32_t;
|
||||
typedef endian<order::native, uint_least64_t, 40> native_u40_t;
|
||||
typedef endian<order::native, uint_least64_t, 48> native_u48_t;
|
||||
typedef endian<order::native, uint_least64_t, 56> native_u56_t;
|
||||
typedef endian<order::native, uint_least64_t, 64> native_u64_t;
|
||||
typedef endian<order::native, uint_least8_t, 8> native_uint8un_t;
|
||||
typedef endian<order::native, uint_least16_t, 16> native_uint16un_t;
|
||||
typedef endian<order::native, uint_least32_t, 24> native_uint24un_t;
|
||||
typedef endian<order::native, uint_least32_t, 32> native_uint32un_t;
|
||||
typedef endian<order::native, uint_least64_t, 40> native_uint40un_t;
|
||||
typedef endian<order::native, uint_least64_t, 48> native_uint48un_t;
|
||||
typedef endian<order::native, uint_least64_t, 56> native_uint56un_t;
|
||||
typedef endian<order::native, uint_least64_t, 64> native_uint64un_t;
|
||||
|
||||
} // namespace endian
|
||||
} // namespace boost</pre>
|
||||
@ -513,7 +543,7 @@ use of Boost.Endian with
|
||||
real compilers.</p>
|
||||
<p><b>Which is better, big-endian or little-endian?</b> Big-endian tends to be a
|
||||
bit more of an industry standard, but little-endian may be preferred for
|
||||
applications that run primarily on x86 (Intel/AMD) and other little-endian
|
||||
applications that run primarily Intel/AMD on x86, x64, and other little-endian
|
||||
CPU's. The <a href="http://en.wikipedia.org/wiki/Endian">Wikipedia</a> article
|
||||
gives more pros and cons.</p>
|
||||
<p><b>What good is <i>native </i>endianness?</b> It provides alignment and
|
||||
@ -526,8 +556,8 @@ common CPU architectures, that optimization is only available for aligned types.
|
||||
That allows I/O of maximally efficient types on an application's primary
|
||||
platform, yet produces data files are portable to all platforms. The code,
|
||||
however, is
|
||||
likely to be more fragile and less portable than with the unaligned types.</p>
|
||||
<p><b>These types are really just byte-holders. Why provide the arithmetic
|
||||
likely to be somewhat less portable than with the unaligned types.</p>
|
||||
<p><b>The endian types are really just byte-holders. Why provide the arithmetic
|
||||
operations at all?</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>
|
||||
@ -536,7 +566,7 @@ incrementing a variable in a record. It is very convenient to write:</p>
|
||||
<pre wrap> int temp(record.foo);
|
||||
++temp;
|
||||
record.foo = temp;</pre>
|
||||
<h2><a name="Design">Design</a> considerations for Boost.Endian integers</h2>
|
||||
<h2><a name="Design">Design</a> considerations for Boost.Endian types</h2>
|
||||
<ul>
|
||||
<li>Must be suitable for I/O - in other words, must be memcpyable.</li>
|
||||
<li>Must provide exactly the size and internal byte ordering specified.</li>
|
||||
@ -552,18 +582,17 @@ incrementing a variable in a record. It is very convenient to write:</p>
|
||||
<li>Unaligned types must not cause compilers to insert padding bytes.</li>
|
||||
<li>The implementation should supply optimizations only in very limited
|
||||
circumstances. Experience has shown that optimizations of endian
|
||||
integers often become pessimizations. While this may be obvious when changing
|
||||
machines or compilers, it also happens when changing compiler switches,
|
||||
integers often become pessimizations when changing
|
||||
machines or compilers. Pessimizations can also happen when changing compiler switches,
|
||||
compiler versions, or CPU models of the same architecture.</li>
|
||||
<li>It is better software engineering if the same implementation works regardless
|
||||
of the CPU endianness. In other words, #ifdefs should be avoided where
|
||||
possible.</li>
|
||||
of the CPU endianness. In other words, #ifdefs should be avoided in user code.</li>
|
||||
</ul>
|
||||
<h2><a name="Experience">Experience</a></h2>
|
||||
<p>Classes with similar functionality have been independently developed by
|
||||
several Boost programmers and used very successful in high-value, high-use
|
||||
applications for many years. These independently developed endian libraries
|
||||
often evolved from C libraries that were also widely used. Endian integers have proven widely useful across a wide
|
||||
often evolved from C libraries that were also widely used. Endian types have proven widely useful across a wide
|
||||
range of computer architectures and applications.</p>
|
||||
<h2><a name="Motivating-use-cases">Motivating use cases</a></h2>
|
||||
<p>Neil Mayhew writes: "I can also provide a meaningful use-case for this
|
||||
@ -603,8 +632,8 @@ sign partial specialization to correctly extend the sign when cover integer size
|
||||
differs from endian representation size.</p>
|
||||
<hr>
|
||||
<p>Last revised:
|
||||
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->22 May, 2013<!--webbot bot="Timestamp" endspan i-checksum="13980" --></p>
|
||||
<p><EFBFBD> Copyright Beman Dawes, 2006-2009</p>
|
||||
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->26 May, 2013<!--webbot bot="Timestamp" endspan i-checksum="13988" --></p>
|
||||
<p>© Copyright Beman Dawes, 2006-2009</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>
|
||||
|
||||
|
@ -127,7 +127,7 @@ namespace endian
|
||||
|
||||
namespace detail
|
||||
// These functions are unsafe for general use, so is placed in namespace detail.
|
||||
// Think of what happens if you reverse_value a std::pair<int16_t, int_16_t>; the bytes
|
||||
// Think of what happens if you reverse_value a std::pair<int16_t, int_int16un_t>; the bytes
|
||||
// from first end up in second and the bytes from second end up in first. Not good!
|
||||
{
|
||||
// general reverse_value function template useful in testing
|
||||
|
@ -81,20 +81,20 @@ namespace endian
|
||||
class endian;
|
||||
|
||||
// aligned big endian floating point types
|
||||
typedef boost::endian::endian<order::big, float, 32, align::yes> big_float32_t;
|
||||
typedef boost::endian::endian<order::big, double, 64, align::yes> big_float64_t;
|
||||
typedef endian<order::big, float, 32, align::yes> big_float32_t;
|
||||
typedef endian<order::big, double, 64, align::yes> big_float64_t;
|
||||
|
||||
// aligned little endian floating point types
|
||||
typedef boost::endian::endian<order::little, float, 32, align::yes> little_float32_t;
|
||||
typedef boost::endian::endian<order::little, double, 64, align::yes> little_float64_t;
|
||||
typedef endian<order::little, float, 32, align::yes> little_float32_t;
|
||||
typedef endian<order::little, double, 64, align::yes> little_float64_t;
|
||||
|
||||
// unaligned big endian floating point types
|
||||
typedef boost::endian::endian<order::big, float, 32, align::no> big_float32un_t;
|
||||
typedef boost::endian::endian<order::big, double, 64, align::no> big_float64un_t;
|
||||
typedef endian<order::big, float, 32, align::no> big_float32un_t;
|
||||
typedef endian<order::big, double, 64, align::no> big_float64un_t;
|
||||
|
||||
// unaligned little endian floating point types
|
||||
typedef boost::endian::endian<order::little, float, 32, align::no> little_float32un_t;
|
||||
typedef boost::endian::endian<order::little, double, 64, align::no> little_float64un_t;
|
||||
typedef endian<order::little, float, 32, align::no> little_float32un_t;
|
||||
typedef endian<order::little, double, 64, align::no> little_float64un_t;
|
||||
|
||||
// aligned big endian signed integer types
|
||||
typedef endian<order::big, int16_t, 16, align::yes> big_int16_t;
|
||||
@ -120,64 +120,64 @@ namespace endian
|
||||
// <cstdint> types are superior for this use case
|
||||
|
||||
// unaligned big endian signed integer types
|
||||
typedef endian<order::big, int_least8_t, 8> big_8_t;
|
||||
typedef endian<order::big, int_least16_t, 16> big_16_t;
|
||||
typedef endian<order::big, int_least32_t, 24> big_24_t;
|
||||
typedef endian<order::big, int_least32_t, 32> big_32_t;
|
||||
typedef endian<order::big, int_least64_t, 40> big_40_t;
|
||||
typedef endian<order::big, int_least64_t, 48> big_48_t;
|
||||
typedef endian<order::big, int_least64_t, 56> big_56_t;
|
||||
typedef endian<order::big, int_least64_t, 64> big_64_t;
|
||||
typedef endian<order::big, int_least8_t, 8> big_int8un_t;
|
||||
typedef endian<order::big, int_least16_t, 16> big_int16un_t;
|
||||
typedef endian<order::big, int_least32_t, 24> big_int24un_t;
|
||||
typedef endian<order::big, int_least32_t, 32> big_int32un_t;
|
||||
typedef endian<order::big, int_least64_t, 40> big_int40un_t;
|
||||
typedef endian<order::big, int_least64_t, 48> big_int48un_t;
|
||||
typedef endian<order::big, int_least64_t, 56> big_int56un_t;
|
||||
typedef endian<order::big, int_least64_t, 64> big_int64un_t;
|
||||
|
||||
// unaligned big endian unsigned integer types
|
||||
typedef endian<order::big, uint_least8_t, 8> big_u8_t;
|
||||
typedef endian<order::big, uint_least16_t, 16> big_u16_t;
|
||||
typedef endian<order::big, uint_least32_t, 24> big_u24_t;
|
||||
typedef endian<order::big, uint_least32_t, 32> big_u32_t;
|
||||
typedef endian<order::big, uint_least64_t, 40> big_u40_t;
|
||||
typedef endian<order::big, uint_least64_t, 48> big_u48_t;
|
||||
typedef endian<order::big, uint_least64_t, 56> big_u56_t;
|
||||
typedef endian<order::big, uint_least64_t, 64> big_u64_t;
|
||||
typedef endian<order::big, uint_least8_t, 8> big_uint8un_t;
|
||||
typedef endian<order::big, uint_least16_t, 16> big_uint16un_t;
|
||||
typedef endian<order::big, uint_least32_t, 24> big_uint24un_t;
|
||||
typedef endian<order::big, uint_least32_t, 32> big_uint32un_t;
|
||||
typedef endian<order::big, uint_least64_t, 40> big_uint40un_t;
|
||||
typedef endian<order::big, uint_least64_t, 48> big_uint48un_t;
|
||||
typedef endian<order::big, uint_least64_t, 56> big_uint56un_t;
|
||||
typedef endian<order::big, uint_least64_t, 64> big_uint64un_t;
|
||||
|
||||
// unaligned little endian signed integer types
|
||||
typedef endian<order::little, int_least8_t, 8> little_8_t;
|
||||
typedef endian<order::little, int_least16_t, 16> little_16_t;
|
||||
typedef endian<order::little, int_least32_t, 24> little_24_t;
|
||||
typedef endian<order::little, int_least32_t, 32> little_32_t;
|
||||
typedef endian<order::little, int_least64_t, 40> little_40_t;
|
||||
typedef endian<order::little, int_least64_t, 48> little_48_t;
|
||||
typedef endian<order::little, int_least64_t, 56> little_56_t;
|
||||
typedef endian<order::little, int_least64_t, 64> little_64_t;
|
||||
typedef endian<order::little, int_least8_t, 8> little_int8un_t;
|
||||
typedef endian<order::little, int_least16_t, 16> little_int16un_t;
|
||||
typedef endian<order::little, int_least32_t, 24> little_int24un_t;
|
||||
typedef endian<order::little, int_least32_t, 32> little_int32un_t;
|
||||
typedef endian<order::little, int_least64_t, 40> little_int40un_t;
|
||||
typedef endian<order::little, int_least64_t, 48> little_int48un_t;
|
||||
typedef endian<order::little, int_least64_t, 56> little_int56un_t;
|
||||
typedef endian<order::little, int_least64_t, 64> little_int64un_t;
|
||||
|
||||
// unaligned little endian unsigned integer types
|
||||
typedef endian<order::little, uint_least8_t, 8> little_u8_t;
|
||||
typedef endian<order::little, uint_least16_t, 16> little_u16_t;
|
||||
typedef endian<order::little, uint_least32_t, 24> little_u24_t;
|
||||
typedef endian<order::little, uint_least32_t, 32> little_u32_t;
|
||||
typedef endian<order::little, uint_least64_t, 40> little_u40_t;
|
||||
typedef endian<order::little, uint_least64_t, 48> little_u48_t;
|
||||
typedef endian<order::little, uint_least64_t, 56> little_u56_t;
|
||||
typedef endian<order::little, uint_least64_t, 64> little_u64_t;
|
||||
typedef endian<order::little, uint_least8_t, 8> little_uint8un_t;
|
||||
typedef endian<order::little, uint_least16_t, 16> little_uint16un_t;
|
||||
typedef endian<order::little, uint_least32_t, 24> little_uint24un_t;
|
||||
typedef endian<order::little, uint_least32_t, 32> little_uint32un_t;
|
||||
typedef endian<order::little, uint_least64_t, 40> little_uint40un_t;
|
||||
typedef endian<order::little, uint_least64_t, 48> little_uint48un_t;
|
||||
typedef endian<order::little, uint_least64_t, 56> little_uint56un_t;
|
||||
typedef endian<order::little, uint_least64_t, 64> little_uint64un_t;
|
||||
|
||||
// unaligned native endian signed integer types
|
||||
typedef endian<order::native, int_least8_t, 8> native_8_t;
|
||||
typedef endian<order::native, int_least16_t, 16> native_16_t;
|
||||
typedef endian<order::native, int_least32_t, 24> native_24_t;
|
||||
typedef endian<order::native, int_least32_t, 32> native_32_t;
|
||||
typedef endian<order::native, int_least64_t, 40> native_40_t;
|
||||
typedef endian<order::native, int_least64_t, 48> native_48_t;
|
||||
typedef endian<order::native, int_least64_t, 56> native_56_t;
|
||||
typedef endian<order::native, int_least64_t, 64> native_64_t;
|
||||
typedef endian<order::native, int_least8_t, 8> native_int8un_t;
|
||||
typedef endian<order::native, int_least16_t, 16> native_int16un_t;
|
||||
typedef endian<order::native, int_least32_t, 24> native_int24un_t;
|
||||
typedef endian<order::native, int_least32_t, 32> native_int32un_t;
|
||||
typedef endian<order::native, int_least64_t, 40> native_int40un_t;
|
||||
typedef endian<order::native, int_least64_t, 48> native_int48un_t;
|
||||
typedef endian<order::native, int_least64_t, 56> native_int56un_t;
|
||||
typedef endian<order::native, int_least64_t, 64> native_int64un_t;
|
||||
|
||||
// unaligned native endian unsigned integer types
|
||||
typedef endian<order::native, uint_least8_t, 8> native_u8_t;
|
||||
typedef endian<order::native, uint_least16_t, 16> native_u16_t;
|
||||
typedef endian<order::native, uint_least32_t, 24> native_u24_t;
|
||||
typedef endian<order::native, uint_least32_t, 32> native_u32_t;
|
||||
typedef endian<order::native, uint_least64_t, 40> native_u40_t;
|
||||
typedef endian<order::native, uint_least64_t, 48> native_u48_t;
|
||||
typedef endian<order::native, uint_least64_t, 56> native_u56_t;
|
||||
typedef endian<order::native, uint_least64_t, 64> native_u64_t;
|
||||
typedef endian<order::native, uint_least8_t, 8> native_uint8un_t;
|
||||
typedef endian<order::native, uint_least16_t, 16> native_uint16un_t;
|
||||
typedef endian<order::native, uint_least32_t, 24> native_uint24un_t;
|
||||
typedef endian<order::native, uint_least32_t, 32> native_uint32un_t;
|
||||
typedef endian<order::native, uint_least64_t, 40> native_uint40un_t;
|
||||
typedef endian<order::native, uint_least64_t, 48> native_uint48un_t;
|
||||
typedef endian<order::native, uint_least64_t, 56> native_uint56un_t;
|
||||
typedef endian<order::native, uint_least64_t, 64> native_uint64un_t;
|
||||
|
||||
} // namespace boost
|
||||
} // namespace endian
|
||||
|
@ -23,59 +23,59 @@ using namespace boost::endian;
|
||||
|
||||
union U
|
||||
{
|
||||
big_8_t big_8;
|
||||
big_16_t big_16;
|
||||
big_24_t big_24;
|
||||
big_32_t big_32;
|
||||
big_40_t big_40;
|
||||
big_48_t big_48;
|
||||
big_56_t big_56;
|
||||
big_64_t big_64;
|
||||
big_int8un_t big_8;
|
||||
big_int16un_t big_16;
|
||||
big_int24un_t big_24;
|
||||
big_int32un_t big_32;
|
||||
big_int40un_t big_40;
|
||||
big_int48un_t big_48;
|
||||
big_int56un_t big_56;
|
||||
big_int64un_t big_64;
|
||||
|
||||
big_u8_t big_u8;
|
||||
big_u16_t big_u16;
|
||||
big_u24_t big_u24;
|
||||
big_u32_t big_u32;
|
||||
big_u40_t big_u40;
|
||||
big_u48_t big_u48;
|
||||
big_u56_t big_u56;
|
||||
big_u64_t big_u64;
|
||||
big_uint8un_t big_u8;
|
||||
big_uint16un_t big_u16;
|
||||
big_uint24un_t big_u24;
|
||||
big_uint32un_t big_u32;
|
||||
big_uint40un_t big_u40;
|
||||
big_uint48un_t big_u48;
|
||||
big_uint56un_t big_u56;
|
||||
big_uint64un_t big_u64;
|
||||
|
||||
little_8_t little_8;
|
||||
little_16_t little_16;
|
||||
little_24_t little_24;
|
||||
little_32_t little_32;
|
||||
little_40_t little_40;
|
||||
little_48_t little_48;
|
||||
little_56_t little_56;
|
||||
little_64_t little_64;
|
||||
little_int8un_t little_8;
|
||||
little_int16un_t little_16;
|
||||
little_int24un_t little_24;
|
||||
little_int32un_t little_32;
|
||||
little_int40un_t little_40;
|
||||
little_int48un_t little_48;
|
||||
little_int56un_t little_56;
|
||||
little_int64un_t little_64;
|
||||
|
||||
little_u8_t little_u8;
|
||||
little_u16_t little_u16;
|
||||
little_u24_t little_u24;
|
||||
little_u32_t little_u32;
|
||||
little_u40_t little_u40;
|
||||
little_u48_t little_u48;
|
||||
little_u56_t little_u56;
|
||||
little_u64_t little_u64;
|
||||
little_uint8un_t little_u8;
|
||||
little_uint16un_t little_u16;
|
||||
little_uint24un_t little_u24;
|
||||
little_uint32un_t little_u32;
|
||||
little_uint40un_t little_u40;
|
||||
little_uint48un_t little_u48;
|
||||
little_uint56un_t little_u56;
|
||||
little_uint64un_t little_u64;
|
||||
|
||||
native_8_t native_8;
|
||||
native_16_t native_16;
|
||||
native_24_t native_24;
|
||||
native_32_t native_32;
|
||||
native_40_t native_40;
|
||||
native_48_t native_48;
|
||||
native_56_t native_56;
|
||||
native_64_t native_64;
|
||||
native_int8un_t native_8;
|
||||
native_int16un_t native_16;
|
||||
native_int24un_t native_24;
|
||||
native_int32un_t native_32;
|
||||
native_int40un_t native_40;
|
||||
native_int48un_t native_48;
|
||||
native_int56un_t native_56;
|
||||
native_int64un_t native_64;
|
||||
|
||||
native_u8_t native_u8;
|
||||
native_u16_t native_u16;
|
||||
native_u24_t native_u24;
|
||||
native_u32_t native_u32;
|
||||
native_u40_t native_u40;
|
||||
native_u48_t native_u48;
|
||||
native_u56_t native_u56;
|
||||
native_u64_t native_u64;
|
||||
native_uint8un_t native_u8;
|
||||
native_uint16un_t native_u16;
|
||||
native_uint24un_t native_u24;
|
||||
native_uint32un_t native_u32;
|
||||
native_uint40un_t native_u40;
|
||||
native_uint48un_t native_u48;
|
||||
native_uint56un_t native_u56;
|
||||
native_uint64un_t native_u64;
|
||||
};
|
||||
|
||||
U foo;
|
||||
|
@ -141,8 +141,8 @@ void op_test_aux()
|
||||
#ifdef BOOST_SHORT_ENDIAN_TEST
|
||||
Test<T1, int>::test();
|
||||
Test<T1, unsigned int>::test();
|
||||
Test<T1, be::big_16_t>::test();
|
||||
Test<T1, be::big_u64_t>::test();
|
||||
Test<T1, be::big_int16un_t>::test();
|
||||
Test<T1, be::big_uint64un_t>::test();
|
||||
#else
|
||||
Test<T1, char>::test();
|
||||
Test<T1, unsigned char>::test();
|
||||
@ -155,54 +155,54 @@ void op_test_aux()
|
||||
Test<T1, unsigned long>::test();
|
||||
Test<T1, long long>::test();
|
||||
Test<T1, unsigned long long>::test();
|
||||
Test<T1, be::big_8_t>::test();
|
||||
Test<T1, be::big_16_t>::test();
|
||||
Test<T1, be::big_24_t>::test();
|
||||
Test<T1, be::big_32_t>::test();
|
||||
Test<T1, be::big_40_t>::test();
|
||||
Test<T1, be::big_48_t>::test();
|
||||
Test<T1, be::big_56_t>::test();
|
||||
Test<T1, be::big_64_t>::test();
|
||||
Test<T1, be::big_u8_t>::test();
|
||||
Test<T1, be::big_u16_t>::test();
|
||||
Test<T1, be::big_u24_t>::test();
|
||||
Test<T1, be::big_u32_t>::test();
|
||||
Test<T1, be::big_u40_t>::test();
|
||||
Test<T1, be::big_u48_t>::test();
|
||||
Test<T1, be::big_u56_t>::test();
|
||||
Test<T1, be::big_u64_t>::test();
|
||||
Test<T1, be::little_8_t>::test();
|
||||
Test<T1, be::little_16_t>::test();
|
||||
Test<T1, be::little_24_t>::test();
|
||||
Test<T1, be::little_32_t>::test();
|
||||
Test<T1, be::little_40_t>::test();
|
||||
Test<T1, be::little_48_t>::test();
|
||||
Test<T1, be::little_56_t>::test();
|
||||
Test<T1, be::little_64_t>::test();
|
||||
Test<T1, be::little_u8_t>::test();
|
||||
Test<T1, be::little_u16_t>::test();
|
||||
Test<T1, be::little_u24_t>::test();
|
||||
Test<T1, be::little_u32_t>::test();
|
||||
Test<T1, be::little_u40_t>::test();
|
||||
Test<T1, be::little_u48_t>::test();
|
||||
Test<T1, be::little_u56_t>::test();
|
||||
Test<T1, be::little_u64_t>::test();
|
||||
Test<T1, be::native_8_t>::test();
|
||||
Test<T1, be::native_16_t>::test();
|
||||
Test<T1, be::native_24_t>::test();
|
||||
Test<T1, be::native_32_t>::test();
|
||||
Test<T1, be::native_40_t>::test();
|
||||
Test<T1, be::native_48_t>::test();
|
||||
Test<T1, be::native_56_t>::test();
|
||||
Test<T1, be::native_64_t>::test();
|
||||
Test<T1, be::native_u8_t>::test();
|
||||
Test<T1, be::native_u16_t>::test();
|
||||
Test<T1, be::native_u24_t>::test();
|
||||
Test<T1, be::native_u32_t>::test();
|
||||
Test<T1, be::native_u40_t>::test();
|
||||
Test<T1, be::native_u48_t>::test();
|
||||
Test<T1, be::native_u56_t>::test();
|
||||
Test<T1, be::native_u64_t>::test();
|
||||
Test<T1, be::big_int8un_t>::test();
|
||||
Test<T1, be::big_int16un_t>::test();
|
||||
Test<T1, be::big_int24un_t>::test();
|
||||
Test<T1, be::big_int32un_t>::test();
|
||||
Test<T1, be::big_int40un_t>::test();
|
||||
Test<T1, be::big_int48un_t>::test();
|
||||
Test<T1, be::big_int56un_t>::test();
|
||||
Test<T1, be::big_int64un_t>::test();
|
||||
Test<T1, be::big_uint8un_t>::test();
|
||||
Test<T1, be::big_uint16un_t>::test();
|
||||
Test<T1, be::big_uint24un_t>::test();
|
||||
Test<T1, be::big_uint32un_t>::test();
|
||||
Test<T1, be::big_uint40un_t>::test();
|
||||
Test<T1, be::big_uint48un_t>::test();
|
||||
Test<T1, be::big_uint56un_t>::test();
|
||||
Test<T1, be::big_uint64un_t>::test();
|
||||
Test<T1, be::little_int8un_t>::test();
|
||||
Test<T1, be::little_int16un_t>::test();
|
||||
Test<T1, be::little_int24un_t>::test();
|
||||
Test<T1, be::little_int32un_t>::test();
|
||||
Test<T1, be::little_int40un_t>::test();
|
||||
Test<T1, be::little_int48un_t>::test();
|
||||
Test<T1, be::little_int56un_t>::test();
|
||||
Test<T1, be::little_int64un_t>::test();
|
||||
Test<T1, be::little_uint8un_t>::test();
|
||||
Test<T1, be::little_uint16un_t>::test();
|
||||
Test<T1, be::little_uint24un_t>::test();
|
||||
Test<T1, be::little_uint32un_t>::test();
|
||||
Test<T1, be::little_uint40un_t>::test();
|
||||
Test<T1, be::little_uint48un_t>::test();
|
||||
Test<T1, be::little_uint56un_t>::test();
|
||||
Test<T1, be::little_uint64un_t>::test();
|
||||
Test<T1, be::native_int8un_t>::test();
|
||||
Test<T1, be::native_int16un_t>::test();
|
||||
Test<T1, be::native_int24un_t>::test();
|
||||
Test<T1, be::native_int32un_t>::test();
|
||||
Test<T1, be::native_int40un_t>::test();
|
||||
Test<T1, be::native_int48un_t>::test();
|
||||
Test<T1, be::native_int56un_t>::test();
|
||||
Test<T1, be::native_int64un_t>::test();
|
||||
Test<T1, be::native_uint8un_t>::test();
|
||||
Test<T1, be::native_uint16un_t>::test();
|
||||
Test<T1, be::native_uint24un_t>::test();
|
||||
Test<T1, be::native_uint32un_t>::test();
|
||||
Test<T1, be::native_uint40un_t>::test();
|
||||
Test<T1, be::native_uint48un_t>::test();
|
||||
Test<T1, be::native_uint56un_t>::test();
|
||||
Test<T1, be::native_uint64un_t>::test();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -212,9 +212,9 @@ void op_test()
|
||||
#ifdef BOOST_SHORT_ENDIAN_TEST
|
||||
op_test_aux<Test, unsigned short>();
|
||||
op_test_aux<Test, int>();
|
||||
op_test_aux<Test, be::big_32_t>();
|
||||
op_test_aux<Test, be::big_u32_t>();
|
||||
op_test_aux<Test, be::little_48_t>();
|
||||
op_test_aux<Test, be::big_int32un_t>();
|
||||
op_test_aux<Test, be::big_uint32un_t>();
|
||||
op_test_aux<Test, be::little_int48un_t>();
|
||||
#else
|
||||
op_test_aux<Test, char>();
|
||||
op_test_aux<Test, unsigned char>();
|
||||
@ -227,54 +227,54 @@ void op_test()
|
||||
op_test_aux<Test, unsigned long>();
|
||||
op_test_aux<Test, long long>();
|
||||
op_test_aux<Test, unsigned long long>();
|
||||
op_test_aux<Test, be::big_8_t>();
|
||||
op_test_aux<Test, be::big_16_t>();
|
||||
op_test_aux<Test, be::big_24_t>();
|
||||
op_test_aux<Test, be::big_32_t>();
|
||||
op_test_aux<Test, be::big_40_t>();
|
||||
op_test_aux<Test, be::big_48_t>();
|
||||
op_test_aux<Test, be::big_56_t>();
|
||||
op_test_aux<Test, be::big_64_t>();
|
||||
op_test_aux<Test, be::big_u8_t>();
|
||||
op_test_aux<Test, be::big_u16_t>();
|
||||
op_test_aux<Test, be::big_u24_t>();
|
||||
op_test_aux<Test, be::big_u32_t>();
|
||||
op_test_aux<Test, be::big_u40_t>();
|
||||
op_test_aux<Test, be::big_u48_t>();
|
||||
op_test_aux<Test, be::big_u56_t>();
|
||||
op_test_aux<Test, be::big_u64_t>();
|
||||
op_test_aux<Test, be::little_8_t>();
|
||||
op_test_aux<Test, be::little_16_t>();
|
||||
op_test_aux<Test, be::little_24_t>();
|
||||
op_test_aux<Test, be::little_32_t>();
|
||||
op_test_aux<Test, be::little_40_t>();
|
||||
op_test_aux<Test, be::little_48_t>();
|
||||
op_test_aux<Test, be::little_56_t>();
|
||||
op_test_aux<Test, be::little_64_t>();
|
||||
op_test_aux<Test, be::little_u8_t>();
|
||||
op_test_aux<Test, be::little_u16_t>();
|
||||
op_test_aux<Test, be::little_u24_t>();
|
||||
op_test_aux<Test, be::little_u32_t>();
|
||||
op_test_aux<Test, be::little_u40_t>();
|
||||
op_test_aux<Test, be::little_u48_t>();
|
||||
op_test_aux<Test, be::little_u56_t>();
|
||||
op_test_aux<Test, be::little_u64_t>();
|
||||
op_test_aux<Test, be::native_8_t>();
|
||||
op_test_aux<Test, be::native_16_t>();
|
||||
op_test_aux<Test, be::native_24_t>();
|
||||
op_test_aux<Test, be::native_32_t>();
|
||||
op_test_aux<Test, be::native_40_t>();
|
||||
op_test_aux<Test, be::native_48_t>();
|
||||
op_test_aux<Test, be::native_56_t>();
|
||||
op_test_aux<Test, be::native_64_t>();
|
||||
op_test_aux<Test, be::native_u8_t>();
|
||||
op_test_aux<Test, be::native_u16_t>();
|
||||
op_test_aux<Test, be::native_u24_t>();
|
||||
op_test_aux<Test, be::native_u32_t>();
|
||||
op_test_aux<Test, be::native_u40_t>();
|
||||
op_test_aux<Test, be::native_u48_t>();
|
||||
op_test_aux<Test, be::native_u56_t>();
|
||||
op_test_aux<Test, be::native_u64_t>();
|
||||
op_test_aux<Test, be::big_int8un_t>();
|
||||
op_test_aux<Test, be::big_int16un_t>();
|
||||
op_test_aux<Test, be::big_int24un_t>();
|
||||
op_test_aux<Test, be::big_int32un_t>();
|
||||
op_test_aux<Test, be::big_int40un_t>();
|
||||
op_test_aux<Test, be::big_int48un_t>();
|
||||
op_test_aux<Test, be::big_int56un_t>();
|
||||
op_test_aux<Test, be::big_int64un_t>();
|
||||
op_test_aux<Test, be::big_uint8un_t>();
|
||||
op_test_aux<Test, be::big_uint16un_t>();
|
||||
op_test_aux<Test, be::big_uint24un_t>();
|
||||
op_test_aux<Test, be::big_uint32un_t>();
|
||||
op_test_aux<Test, be::big_uint40un_t>();
|
||||
op_test_aux<Test, be::big_uint48un_t>();
|
||||
op_test_aux<Test, be::big_uint56un_t>();
|
||||
op_test_aux<Test, be::big_uint64un_t>();
|
||||
op_test_aux<Test, be::little_int8un_t>();
|
||||
op_test_aux<Test, be::little_int16un_t>();
|
||||
op_test_aux<Test, be::little_int24un_t>();
|
||||
op_test_aux<Test, be::little_int32un_t>();
|
||||
op_test_aux<Test, be::little_int40un_t>();
|
||||
op_test_aux<Test, be::little_int48un_t>();
|
||||
op_test_aux<Test, be::little_int56un_t>();
|
||||
op_test_aux<Test, be::little_int64un_t>();
|
||||
op_test_aux<Test, be::little_uint8un_t>();
|
||||
op_test_aux<Test, be::little_uint16un_t>();
|
||||
op_test_aux<Test, be::little_uint24un_t>();
|
||||
op_test_aux<Test, be::little_uint32un_t>();
|
||||
op_test_aux<Test, be::little_uint40un_t>();
|
||||
op_test_aux<Test, be::little_uint48un_t>();
|
||||
op_test_aux<Test, be::little_uint56un_t>();
|
||||
op_test_aux<Test, be::little_uint64un_t>();
|
||||
op_test_aux<Test, be::native_int8un_t>();
|
||||
op_test_aux<Test, be::native_int16un_t>();
|
||||
op_test_aux<Test, be::native_int24un_t>();
|
||||
op_test_aux<Test, be::native_int32un_t>();
|
||||
op_test_aux<Test, be::native_int40un_t>();
|
||||
op_test_aux<Test, be::native_int48un_t>();
|
||||
op_test_aux<Test, be::native_int56un_t>();
|
||||
op_test_aux<Test, be::native_int64un_t>();
|
||||
op_test_aux<Test, be::native_uint8un_t>();
|
||||
op_test_aux<Test, be::native_uint16un_t>();
|
||||
op_test_aux<Test, be::native_uint24un_t>();
|
||||
op_test_aux<Test, be::native_uint32un_t>();
|
||||
op_test_aux<Test, be::native_uint40un_t>();
|
||||
op_test_aux<Test, be::native_uint48un_t>();
|
||||
op_test_aux<Test, be::native_uint56un_t>();
|
||||
op_test_aux<Test, be::native_uint64un_t>();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -286,10 +286,10 @@ int cpp_main(int, char * [])
|
||||
|
||||
// make sure some simple things work
|
||||
|
||||
be::big_32_t o1(1);
|
||||
be::big_32_t o2(2L);
|
||||
be::big_32_t o3(3LL);
|
||||
be::big_64_t o4(1);
|
||||
be::big_int32un_t o1(1);
|
||||
be::big_int32un_t o2(2L);
|
||||
be::big_int32un_t o3(3LL);
|
||||
be::big_int64un_t o4(1);
|
||||
|
||||
// use cases; if BOOST_ENDIAN_LOG is defined, will output to clog info on
|
||||
// what overloads and conversions are actually being performed.
|
||||
@ -297,9 +297,9 @@ int cpp_main(int, char * [])
|
||||
be::endian_log = true;
|
||||
|
||||
std::clog << "set up test values\n";
|
||||
be::big_32_t big(12345);
|
||||
be::little_u16_t little_u(10);
|
||||
be::big_64_t result;
|
||||
be::big_int32un_t big(12345);
|
||||
be::little_uint16un_t little_u(10);
|
||||
be::big_int64un_t result;
|
||||
|
||||
|
||||
std::clog << "\nresult = +big\n";
|
||||
@ -358,15 +358,15 @@ int cpp_main(int, char * [])
|
||||
|
||||
// test from Roland Schwarz that detected ambiguities
|
||||
unsigned u;
|
||||
be::little_u32_t u1;
|
||||
be::little_u32_t u2;
|
||||
be::little_uint32un_t u1;
|
||||
be::little_uint32un_t u2;
|
||||
|
||||
u = 1;
|
||||
u1 = 1;
|
||||
u2 = u1 + u;
|
||||
|
||||
// one more wrinkle
|
||||
be::little_u16_t u3(3);
|
||||
be::little_uint16un_t u3(3);
|
||||
u3 = 3;
|
||||
u2 = u1 + u3;
|
||||
|
||||
|
@ -155,59 +155,59 @@ namespace
|
||||
|
||||
void check_data()
|
||||
{
|
||||
big_8_t big_8;
|
||||
big_16_t big_16;
|
||||
big_24_t big_24;
|
||||
big_32_t big_32;
|
||||
big_40_t big_40;
|
||||
big_48_t big_48;
|
||||
big_56_t big_56;
|
||||
big_64_t big_64;
|
||||
big_int8un_t big_8;
|
||||
big_int16un_t big_16;
|
||||
big_int24un_t big_24;
|
||||
big_int32un_t big_32;
|
||||
big_int40un_t big_40;
|
||||
big_int48un_t big_48;
|
||||
big_int56un_t big_56;
|
||||
big_int64un_t big_64;
|
||||
|
||||
big_u8_t big_u8;
|
||||
big_u16_t big_u16;
|
||||
big_u24_t big_u24;
|
||||
big_u32_t big_u32;
|
||||
big_u40_t big_u40;
|
||||
big_u48_t big_u48;
|
||||
big_u56_t big_u56;
|
||||
big_u64_t big_u64;
|
||||
big_uint8un_t big_u8;
|
||||
big_uint16un_t big_u16;
|
||||
big_uint24un_t big_u24;
|
||||
big_uint32un_t big_u32;
|
||||
big_uint40un_t big_u40;
|
||||
big_uint48un_t big_u48;
|
||||
big_uint56un_t big_u56;
|
||||
big_uint64un_t big_u64;
|
||||
|
||||
little_8_t little_8;
|
||||
little_16_t little_16;
|
||||
little_24_t little_24;
|
||||
little_32_t little_32;
|
||||
little_40_t little_40;
|
||||
little_48_t little_48;
|
||||
little_56_t little_56;
|
||||
little_64_t little_64;
|
||||
little_int8un_t little_8;
|
||||
little_int16un_t little_16;
|
||||
little_int24un_t little_24;
|
||||
little_int32un_t little_32;
|
||||
little_int40un_t little_40;
|
||||
little_int48un_t little_48;
|
||||
little_int56un_t little_56;
|
||||
little_int64un_t little_64;
|
||||
|
||||
little_u8_t little_u8;
|
||||
little_u16_t little_u16;
|
||||
little_u24_t little_u24;
|
||||
little_u32_t little_u32;
|
||||
little_u40_t little_u40;
|
||||
little_u48_t little_u48;
|
||||
little_u56_t little_u56;
|
||||
little_u64_t little_u64;
|
||||
little_uint8un_t little_u8;
|
||||
little_uint16un_t little_u16;
|
||||
little_uint24un_t little_u24;
|
||||
little_uint32un_t little_u32;
|
||||
little_uint40un_t little_u40;
|
||||
little_uint48un_t little_u48;
|
||||
little_uint56un_t little_u56;
|
||||
little_uint64un_t little_u64;
|
||||
|
||||
native_8_t native_8;
|
||||
native_16_t native_16;
|
||||
native_24_t native_24;
|
||||
native_32_t native_32;
|
||||
native_40_t native_40;
|
||||
native_48_t native_48;
|
||||
native_56_t native_56;
|
||||
native_64_t native_64;
|
||||
native_int8un_t native_8;
|
||||
native_int16un_t native_16;
|
||||
native_int24un_t native_24;
|
||||
native_int32un_t native_32;
|
||||
native_int40un_t native_40;
|
||||
native_int48un_t native_48;
|
||||
native_int56un_t native_56;
|
||||
native_int64un_t native_64;
|
||||
|
||||
native_u8_t native_u8;
|
||||
native_u16_t native_u16;
|
||||
native_u24_t native_u24;
|
||||
native_u32_t native_u32;
|
||||
native_u40_t native_u40;
|
||||
native_u48_t native_u48;
|
||||
native_u56_t native_u56;
|
||||
native_u64_t native_u64;
|
||||
native_uint8un_t native_u8;
|
||||
native_uint16un_t native_u16;
|
||||
native_uint24un_t native_u24;
|
||||
native_uint32un_t native_u32;
|
||||
native_uint40un_t native_u40;
|
||||
native_uint48un_t native_u48;
|
||||
native_uint56un_t native_u56;
|
||||
native_uint64un_t native_u64;
|
||||
|
||||
big_int16_t big_int16;
|
||||
big_int32_t big_int32;
|
||||
@ -336,59 +336,59 @@ namespace
|
||||
VERIFY_SIZE(sizeof( little_float32un_t ), 4 );
|
||||
VERIFY_SIZE(sizeof( little_float64un_t ), 8 );
|
||||
|
||||
VERIFY_SIZE( sizeof( big_8_t ), 1 );
|
||||
VERIFY_SIZE( sizeof( big_16_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( big_24_t ), 3 );
|
||||
VERIFY_SIZE( sizeof( big_32_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( big_40_t ), 5 );
|
||||
VERIFY_SIZE( sizeof( big_48_t ), 6 );
|
||||
VERIFY_SIZE( sizeof( big_56_t ), 7 );
|
||||
VERIFY_SIZE( sizeof( big_64_t ), 8 );
|
||||
VERIFY_SIZE( sizeof( big_int8un_t ), 1 );
|
||||
VERIFY_SIZE( sizeof( big_int16un_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( big_int24un_t ), 3 );
|
||||
VERIFY_SIZE( sizeof( big_int32un_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( big_int40un_t ), 5 );
|
||||
VERIFY_SIZE( sizeof( big_int48un_t ), 6 );
|
||||
VERIFY_SIZE( sizeof( big_int56un_t ), 7 );
|
||||
VERIFY_SIZE( sizeof( big_int64un_t ), 8 );
|
||||
|
||||
VERIFY_SIZE( sizeof( big_u8_t ), 1 );
|
||||
VERIFY_SIZE( sizeof( big_u16_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( big_u24_t ), 3 );
|
||||
VERIFY_SIZE( sizeof( big_u32_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( big_u40_t ), 5 );
|
||||
VERIFY_SIZE( sizeof( big_u48_t ), 6 );
|
||||
VERIFY_SIZE( sizeof( big_u56_t ), 7 );
|
||||
VERIFY_SIZE( sizeof( big_u64_t ), 8 );
|
||||
VERIFY_SIZE( sizeof( big_uint8un_t ), 1 );
|
||||
VERIFY_SIZE( sizeof( big_uint16un_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( big_uint24un_t ), 3 );
|
||||
VERIFY_SIZE( sizeof( big_uint32un_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( big_uint40un_t ), 5 );
|
||||
VERIFY_SIZE( sizeof( big_uint48un_t ), 6 );
|
||||
VERIFY_SIZE( sizeof( big_uint56un_t ), 7 );
|
||||
VERIFY_SIZE( sizeof( big_uint64un_t ), 8 );
|
||||
|
||||
VERIFY_SIZE( sizeof( little_8_t ), 1 );
|
||||
VERIFY_SIZE( sizeof( little_16_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( little_24_t ), 3 );
|
||||
VERIFY_SIZE( sizeof( little_32_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( little_40_t ), 5 );
|
||||
VERIFY_SIZE( sizeof( little_48_t ), 6 );
|
||||
VERIFY_SIZE( sizeof( little_56_t ), 7 );
|
||||
VERIFY_SIZE( sizeof( little_64_t ), 8 );
|
||||
VERIFY_SIZE( sizeof( little_int8un_t ), 1 );
|
||||
VERIFY_SIZE( sizeof( little_int16un_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( little_int24un_t ), 3 );
|
||||
VERIFY_SIZE( sizeof( little_int32un_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( little_int40un_t ), 5 );
|
||||
VERIFY_SIZE( sizeof( little_int48un_t ), 6 );
|
||||
VERIFY_SIZE( sizeof( little_int56un_t ), 7 );
|
||||
VERIFY_SIZE( sizeof( little_int64un_t ), 8 );
|
||||
|
||||
VERIFY_SIZE( sizeof( little_u8_t ), 1 );
|
||||
VERIFY_SIZE( sizeof( little_u16_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( little_u24_t ), 3 );
|
||||
VERIFY_SIZE( sizeof( little_u32_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( little_u40_t ), 5 );
|
||||
VERIFY_SIZE( sizeof( little_u48_t ), 6 );
|
||||
VERIFY_SIZE( sizeof( little_u56_t ), 7 );
|
||||
VERIFY_SIZE( sizeof( little_u64_t ), 8 );
|
||||
VERIFY_SIZE( sizeof( little_uint8un_t ), 1 );
|
||||
VERIFY_SIZE( sizeof( little_uint16un_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( little_uint24un_t ), 3 );
|
||||
VERIFY_SIZE( sizeof( little_uint32un_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( little_uint40un_t ), 5 );
|
||||
VERIFY_SIZE( sizeof( little_uint48un_t ), 6 );
|
||||
VERIFY_SIZE( sizeof( little_uint56un_t ), 7 );
|
||||
VERIFY_SIZE( sizeof( little_uint64un_t ), 8 );
|
||||
|
||||
VERIFY_SIZE( sizeof( native_8_t ), 1 );
|
||||
VERIFY_SIZE( sizeof( native_16_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( native_24_t ), 3 );
|
||||
VERIFY_SIZE( sizeof( native_32_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( native_40_t ), 5 );
|
||||
VERIFY_SIZE( sizeof( native_48_t ), 6 );
|
||||
VERIFY_SIZE( sizeof( native_56_t ), 7 );
|
||||
VERIFY_SIZE( sizeof( native_64_t ), 8 );
|
||||
VERIFY_SIZE( sizeof( native_int8un_t ), 1 );
|
||||
VERIFY_SIZE( sizeof( native_int16un_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( native_int24un_t ), 3 );
|
||||
VERIFY_SIZE( sizeof( native_int32un_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( native_int40un_t ), 5 );
|
||||
VERIFY_SIZE( sizeof( native_int48un_t ), 6 );
|
||||
VERIFY_SIZE( sizeof( native_int56un_t ), 7 );
|
||||
VERIFY_SIZE( sizeof( native_int64un_t ), 8 );
|
||||
|
||||
VERIFY_SIZE( sizeof( native_u8_t ), 1 );
|
||||
VERIFY_SIZE( sizeof( native_u16_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( native_u24_t ), 3 );
|
||||
VERIFY_SIZE( sizeof( native_u32_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( native_u40_t ), 5 );
|
||||
VERIFY_SIZE( sizeof( native_u48_t ), 6 );
|
||||
VERIFY_SIZE( sizeof( native_u56_t ), 7 );
|
||||
VERIFY_SIZE( sizeof( native_u64_t ), 8 );
|
||||
VERIFY_SIZE( sizeof( native_uint8un_t ), 1 );
|
||||
VERIFY_SIZE( sizeof( native_uint16un_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( native_uint24un_t ), 3 );
|
||||
VERIFY_SIZE( sizeof( native_uint32un_t ), 4 );
|
||||
VERIFY_SIZE( sizeof( native_uint40un_t ), 5 );
|
||||
VERIFY_SIZE( sizeof( native_uint48un_t ), 6 );
|
||||
VERIFY_SIZE( sizeof( native_uint56un_t ), 7 );
|
||||
VERIFY_SIZE( sizeof( native_uint64un_t ), 8 );
|
||||
|
||||
VERIFY_SIZE( sizeof( big_int16_t ), 2 );
|
||||
VERIFY_SIZE( sizeof( big_int32_t ), 4 );
|
||||
@ -416,92 +416,92 @@ namespace
|
||||
|
||||
struct big_struct
|
||||
{
|
||||
big_8_t v0;
|
||||
big_16_t v1;
|
||||
big_24_t v3;
|
||||
big_int8un_t v0;
|
||||
big_int16un_t v1;
|
||||
big_int24un_t v3;
|
||||
char v6;
|
||||
big_32_t v7;
|
||||
big_40_t v11;
|
||||
big_int32un_t v7;
|
||||
big_int40un_t v11;
|
||||
char v16;
|
||||
big_48_t v17;
|
||||
big_56_t v23;
|
||||
big_int48un_t v17;
|
||||
big_int56un_t v23;
|
||||
char v30;
|
||||
big_64_t v31;
|
||||
big_int64un_t v31;
|
||||
};
|
||||
|
||||
struct big_u_struct
|
||||
{
|
||||
big_u8_t v0;
|
||||
big_u16_t v1;
|
||||
big_u24_t v3;
|
||||
big_uint8un_t v0;
|
||||
big_uint16un_t v1;
|
||||
big_uint24un_t v3;
|
||||
char v6;
|
||||
big_u32_t v7;
|
||||
big_u40_t v11;
|
||||
big_uint32un_t v7;
|
||||
big_uint40un_t v11;
|
||||
char v16;
|
||||
big_u48_t v17;
|
||||
big_u56_t v23;
|
||||
big_uint48un_t v17;
|
||||
big_uint56un_t v23;
|
||||
char v30;
|
||||
big_u64_t v31;
|
||||
big_uint64un_t v31;
|
||||
};
|
||||
|
||||
struct little_struct
|
||||
{
|
||||
little_8_t v0;
|
||||
little_16_t v1;
|
||||
little_24_t v3;
|
||||
little_int8un_t v0;
|
||||
little_int16un_t v1;
|
||||
little_int24un_t v3;
|
||||
char v6;
|
||||
little_32_t v7;
|
||||
little_40_t v11;
|
||||
little_int32un_t v7;
|
||||
little_int40un_t v11;
|
||||
char v16;
|
||||
little_48_t v17;
|
||||
little_56_t v23;
|
||||
little_int48un_t v17;
|
||||
little_int56un_t v23;
|
||||
char v30;
|
||||
little_64_t v31;
|
||||
little_int64un_t v31;
|
||||
};
|
||||
|
||||
struct little_u_struct
|
||||
{
|
||||
little_u8_t v0;
|
||||
little_u16_t v1;
|
||||
little_u24_t v3;
|
||||
little_uint8un_t v0;
|
||||
little_uint16un_t v1;
|
||||
little_uint24un_t v3;
|
||||
char v6;
|
||||
little_u32_t v7;
|
||||
little_u40_t v11;
|
||||
little_uint32un_t v7;
|
||||
little_uint40un_t v11;
|
||||
char v16;
|
||||
little_u48_t v17;
|
||||
little_u56_t v23;
|
||||
little_uint48un_t v17;
|
||||
little_uint56un_t v23;
|
||||
char v30;
|
||||
little_u64_t v31;
|
||||
little_uint64un_t v31;
|
||||
};
|
||||
|
||||
struct native_struct
|
||||
{
|
||||
native_8_t v0;
|
||||
native_16_t v1;
|
||||
native_24_t v3;
|
||||
native_int8un_t v0;
|
||||
native_int16un_t v1;
|
||||
native_int24un_t v3;
|
||||
char v6;
|
||||
native_32_t v7;
|
||||
native_40_t v11;
|
||||
native_int32un_t v7;
|
||||
native_int40un_t v11;
|
||||
char v16;
|
||||
native_48_t v17;
|
||||
native_56_t v23;
|
||||
native_int48un_t v17;
|
||||
native_int56un_t v23;
|
||||
char v30;
|
||||
native_64_t v31;
|
||||
native_int64un_t v31;
|
||||
};
|
||||
|
||||
struct native_u_struct
|
||||
{
|
||||
native_u8_t v0;
|
||||
native_u16_t v1;
|
||||
native_u24_t v3;
|
||||
native_uint8un_t v0;
|
||||
native_uint16un_t v1;
|
||||
native_uint24un_t v3;
|
||||
char v6;
|
||||
native_u32_t v7;
|
||||
native_u40_t v11;
|
||||
native_uint32un_t v7;
|
||||
native_uint40un_t v11;
|
||||
char v16;
|
||||
native_u48_t v17;
|
||||
native_u56_t v23;
|
||||
native_uint48un_t v17;
|
||||
native_uint56un_t v23;
|
||||
char v30;
|
||||
native_u64_t v31;
|
||||
native_uint64un_t v31;
|
||||
};
|
||||
|
||||
struct big_float_struct
|
||||
@ -639,173 +639,173 @@ namespace
|
||||
VERIFY(a==e);
|
||||
|
||||
// unaligned integer types
|
||||
VERIFY_BIG_REPRESENTATION( big_8_t );
|
||||
VERIFY_VALUE_AND_OPS( big_8_t, int_least8_t, 0x7f );
|
||||
VERIFY_VALUE_AND_OPS( big_8_t, int_least8_t, -0x80 );
|
||||
VERIFY_BIG_REPRESENTATION( big_int8un_t );
|
||||
VERIFY_VALUE_AND_OPS( big_int8un_t, int_least8_t, 0x7f );
|
||||
VERIFY_VALUE_AND_OPS( big_int8un_t, int_least8_t, -0x80 );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big_16_t );
|
||||
VERIFY_VALUE_AND_OPS( big_16_t, int_least16_t, 0x7fff );
|
||||
VERIFY_VALUE_AND_OPS( big_16_t, int_least16_t, -0x8000 );
|
||||
VERIFY_BIG_REPRESENTATION( big_int16un_t );
|
||||
VERIFY_VALUE_AND_OPS( big_int16un_t, int_least16_t, 0x7fff );
|
||||
VERIFY_VALUE_AND_OPS( big_int16un_t, int_least16_t, -0x8000 );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big_24_t );
|
||||
VERIFY_VALUE_AND_OPS( big_24_t, int_least32_t, 0x7fffff );
|
||||
VERIFY_VALUE_AND_OPS( big_24_t, int_least32_t, -0x800000 );
|
||||
VERIFY_BIG_REPRESENTATION( big_int24un_t );
|
||||
VERIFY_VALUE_AND_OPS( big_int24un_t, int_least32_t, 0x7fffff );
|
||||
VERIFY_VALUE_AND_OPS( big_int24un_t, int_least32_t, -0x800000 );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big_32_t );
|
||||
VERIFY_VALUE_AND_OPS( big_32_t, int_least32_t, 0x7fffffff );
|
||||
VERIFY_VALUE_AND_OPS( big_32_t, int_least32_t, -0x7fffffff-1 );
|
||||
VERIFY_BIG_REPRESENTATION( big_int32un_t );
|
||||
VERIFY_VALUE_AND_OPS( big_int32un_t, int_least32_t, 0x7fffffff );
|
||||
VERIFY_VALUE_AND_OPS( big_int32un_t, int_least32_t, -0x7fffffff-1 );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big_40_t );
|
||||
VERIFY_VALUE_AND_OPS( big_40_t, int_least64_t, 0x7fffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( big_40_t, int_least64_t, -0x8000000000LL );
|
||||
VERIFY_BIG_REPRESENTATION( big_int40un_t );
|
||||
VERIFY_VALUE_AND_OPS( big_int40un_t, int_least64_t, 0x7fffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( big_int40un_t, int_least64_t, -0x8000000000LL );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big_48_t );
|
||||
VERIFY_VALUE_AND_OPS( big_48_t, int_least64_t, 0x7fffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( big_48_t, int_least64_t, -0x800000000000LL );
|
||||
VERIFY_BIG_REPRESENTATION( big_int48un_t );
|
||||
VERIFY_VALUE_AND_OPS( big_int48un_t, int_least64_t, 0x7fffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( big_int48un_t, int_least64_t, -0x800000000000LL );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big_56_t );
|
||||
VERIFY_VALUE_AND_OPS( big_56_t, int_least64_t, 0x7fffffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( big_56_t, int_least64_t, -0x80000000000000LL );
|
||||
VERIFY_BIG_REPRESENTATION( big_int56un_t );
|
||||
VERIFY_VALUE_AND_OPS( big_int56un_t, int_least64_t, 0x7fffffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( big_int56un_t, int_least64_t, -0x80000000000000LL );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big_64_t );
|
||||
VERIFY_VALUE_AND_OPS( big_64_t, int_least64_t, 0x7fffffffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( big_64_t, int_least64_t, -0x7fffffffffffffffLL-1 );
|
||||
VERIFY_BIG_REPRESENTATION( big_int64un_t );
|
||||
VERIFY_VALUE_AND_OPS( big_int64un_t, int_least64_t, 0x7fffffffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( big_int64un_t, int_least64_t, -0x7fffffffffffffffLL-1 );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big_u8_t );
|
||||
VERIFY_VALUE_AND_OPS( big_u8_t, uint_least8_t, 0xff );
|
||||
VERIFY_BIG_REPRESENTATION( big_uint8un_t );
|
||||
VERIFY_VALUE_AND_OPS( big_uint8un_t, uint_least8_t, 0xff );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big_u16_t );
|
||||
VERIFY_VALUE_AND_OPS( big_u16_t, uint_least16_t, 0xffff );
|
||||
VERIFY_BIG_REPRESENTATION( big_uint16un_t );
|
||||
VERIFY_VALUE_AND_OPS( big_uint16un_t, uint_least16_t, 0xffff );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big_u24_t );
|
||||
VERIFY_VALUE_AND_OPS( big_u24_t, uint_least32_t, 0xffffff );
|
||||
VERIFY_BIG_REPRESENTATION( big_uint24un_t );
|
||||
VERIFY_VALUE_AND_OPS( big_uint24un_t, uint_least32_t, 0xffffff );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big_u32_t );
|
||||
VERIFY_VALUE_AND_OPS( big_u32_t, uint_least32_t, 0xffffffff );
|
||||
VERIFY_BIG_REPRESENTATION( big_uint32un_t );
|
||||
VERIFY_VALUE_AND_OPS( big_uint32un_t, uint_least32_t, 0xffffffff );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big_u40_t );
|
||||
VERIFY_VALUE_AND_OPS( big_u40_t, uint_least64_t, 0xffffffffffLL );
|
||||
VERIFY_BIG_REPRESENTATION( big_uint40un_t );
|
||||
VERIFY_VALUE_AND_OPS( big_uint40un_t, uint_least64_t, 0xffffffffffLL );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big_u48_t );
|
||||
VERIFY_VALUE_AND_OPS( big_u48_t, uint_least64_t, 0xffffffffffffLL );
|
||||
VERIFY_BIG_REPRESENTATION( big_uint48un_t );
|
||||
VERIFY_VALUE_AND_OPS( big_uint48un_t, uint_least64_t, 0xffffffffffffLL );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big_u56_t );
|
||||
VERIFY_VALUE_AND_OPS( big_u56_t, uint_least64_t, 0xffffffffffffffLL );
|
||||
VERIFY_BIG_REPRESENTATION( big_uint56un_t );
|
||||
VERIFY_VALUE_AND_OPS( big_uint56un_t, uint_least64_t, 0xffffffffffffffLL );
|
||||
|
||||
VERIFY_BIG_REPRESENTATION( big_u64_t );
|
||||
VERIFY_VALUE_AND_OPS( big_u64_t, uint_least64_t, 0xffffffffffffffffULL );
|
||||
VERIFY_BIG_REPRESENTATION( big_uint64un_t );
|
||||
VERIFY_VALUE_AND_OPS( big_uint64un_t, uint_least64_t, 0xffffffffffffffffULL );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little_8_t );
|
||||
VERIFY_VALUE_AND_OPS( little_8_t, int_least8_t, 0x7f );
|
||||
VERIFY_VALUE_AND_OPS( little_8_t, int_least8_t, -0x80 );
|
||||
VERIFY_LITTLE_REPRESENTATION( little_int8un_t );
|
||||
VERIFY_VALUE_AND_OPS( little_int8un_t, int_least8_t, 0x7f );
|
||||
VERIFY_VALUE_AND_OPS( little_int8un_t, int_least8_t, -0x80 );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little_16_t );
|
||||
VERIFY_VALUE_AND_OPS( little_16_t, int_least16_t, 0x7fff );
|
||||
VERIFY_VALUE_AND_OPS( little_16_t, int_least16_t, -0x8000 );
|
||||
VERIFY_LITTLE_REPRESENTATION( little_int16un_t );
|
||||
VERIFY_VALUE_AND_OPS( little_int16un_t, int_least16_t, 0x7fff );
|
||||
VERIFY_VALUE_AND_OPS( little_int16un_t, int_least16_t, -0x8000 );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little_24_t );
|
||||
VERIFY_VALUE_AND_OPS( little_24_t, int_least32_t, 0x7fffff );
|
||||
VERIFY_VALUE_AND_OPS( little_24_t, int_least32_t, -0x800000 );
|
||||
VERIFY_LITTLE_REPRESENTATION( little_int24un_t );
|
||||
VERIFY_VALUE_AND_OPS( little_int24un_t, int_least32_t, 0x7fffff );
|
||||
VERIFY_VALUE_AND_OPS( little_int24un_t, int_least32_t, -0x800000 );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little_32_t );
|
||||
VERIFY_VALUE_AND_OPS( little_32_t, int_least32_t, 0x7fffffff );
|
||||
VERIFY_VALUE_AND_OPS( little_32_t, int_least32_t, -0x7fffffff-1 );
|
||||
VERIFY_LITTLE_REPRESENTATION( little_int32un_t );
|
||||
VERIFY_VALUE_AND_OPS( little_int32un_t, int_least32_t, 0x7fffffff );
|
||||
VERIFY_VALUE_AND_OPS( little_int32un_t, int_least32_t, -0x7fffffff-1 );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little_40_t );
|
||||
VERIFY_VALUE_AND_OPS( little_40_t, int_least64_t, 0x7fffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( little_40_t, int_least64_t, -0x8000000000LL );
|
||||
VERIFY_LITTLE_REPRESENTATION( little_int40un_t );
|
||||
VERIFY_VALUE_AND_OPS( little_int40un_t, int_least64_t, 0x7fffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( little_int40un_t, int_least64_t, -0x8000000000LL );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little_48_t );
|
||||
VERIFY_VALUE_AND_OPS( little_48_t, int_least64_t, 0x7fffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( little_48_t, int_least64_t, -0x800000000000LL );
|
||||
VERIFY_LITTLE_REPRESENTATION( little_int48un_t );
|
||||
VERIFY_VALUE_AND_OPS( little_int48un_t, int_least64_t, 0x7fffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( little_int48un_t, int_least64_t, -0x800000000000LL );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little_56_t );
|
||||
VERIFY_VALUE_AND_OPS( little_56_t, int_least64_t, 0x7fffffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( little_56_t, int_least64_t, -0x80000000000000LL );
|
||||
VERIFY_LITTLE_REPRESENTATION( little_int56un_t );
|
||||
VERIFY_VALUE_AND_OPS( little_int56un_t, int_least64_t, 0x7fffffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( little_int56un_t, int_least64_t, -0x80000000000000LL );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little_64_t );
|
||||
VERIFY_VALUE_AND_OPS( little_64_t, int_least64_t, 0x7fffffffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( little_64_t, int_least64_t, -0x7fffffffffffffffLL-1 );
|
||||
VERIFY_LITTLE_REPRESENTATION( little_int64un_t );
|
||||
VERIFY_VALUE_AND_OPS( little_int64un_t, int_least64_t, 0x7fffffffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( little_int64un_t, int_least64_t, -0x7fffffffffffffffLL-1 );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little_u8_t );
|
||||
VERIFY_VALUE_AND_OPS( little_u8_t, uint_least8_t, 0xff );
|
||||
VERIFY_LITTLE_REPRESENTATION( little_uint8un_t );
|
||||
VERIFY_VALUE_AND_OPS( little_uint8un_t, uint_least8_t, 0xff );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little_u16_t );
|
||||
VERIFY_VALUE_AND_OPS( little_u16_t, uint_least16_t, 0xffff );
|
||||
VERIFY_LITTLE_REPRESENTATION( little_uint16un_t );
|
||||
VERIFY_VALUE_AND_OPS( little_uint16un_t, uint_least16_t, 0xffff );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little_u24_t );
|
||||
VERIFY_VALUE_AND_OPS( little_u24_t, uint_least32_t, 0xffffff );
|
||||
VERIFY_LITTLE_REPRESENTATION( little_uint24un_t );
|
||||
VERIFY_VALUE_AND_OPS( little_uint24un_t, uint_least32_t, 0xffffff );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little_u32_t );
|
||||
VERIFY_VALUE_AND_OPS( little_u32_t, uint_least32_t, 0xffffffff );
|
||||
VERIFY_LITTLE_REPRESENTATION( little_uint32un_t );
|
||||
VERIFY_VALUE_AND_OPS( little_uint32un_t, uint_least32_t, 0xffffffff );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little_u40_t );
|
||||
VERIFY_VALUE_AND_OPS( little_u40_t, uint_least64_t, 0xffffffffffLL );
|
||||
VERIFY_LITTLE_REPRESENTATION( little_uint40un_t );
|
||||
VERIFY_VALUE_AND_OPS( little_uint40un_t, uint_least64_t, 0xffffffffffLL );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little_u48_t );
|
||||
VERIFY_VALUE_AND_OPS( little_u48_t, uint_least64_t, 0xffffffffffffLL );
|
||||
VERIFY_LITTLE_REPRESENTATION( little_uint48un_t );
|
||||
VERIFY_VALUE_AND_OPS( little_uint48un_t, uint_least64_t, 0xffffffffffffLL );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little_u56_t );
|
||||
VERIFY_VALUE_AND_OPS( little_u56_t, uint_least64_t, 0xffffffffffffffLL );
|
||||
VERIFY_LITTLE_REPRESENTATION( little_uint56un_t );
|
||||
VERIFY_VALUE_AND_OPS( little_uint56un_t, uint_least64_t, 0xffffffffffffffLL );
|
||||
|
||||
VERIFY_LITTLE_REPRESENTATION( little_u64_t );
|
||||
VERIFY_VALUE_AND_OPS( little_u64_t, uint_least64_t, 0xffffffffffffffffULL );
|
||||
VERIFY_LITTLE_REPRESENTATION( little_uint64un_t );
|
||||
VERIFY_VALUE_AND_OPS( little_uint64un_t, uint_least64_t, 0xffffffffffffffffULL );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native_8_t );
|
||||
VERIFY_VALUE_AND_OPS( native_8_t, int_least8_t, 0x7f );
|
||||
VERIFY_VALUE_AND_OPS( native_8_t, int_least8_t, -0x80 );
|
||||
VERIFY_NATIVE_REPRESENTATION( native_int8un_t );
|
||||
VERIFY_VALUE_AND_OPS( native_int8un_t, int_least8_t, 0x7f );
|
||||
VERIFY_VALUE_AND_OPS( native_int8un_t, int_least8_t, -0x80 );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native_16_t );
|
||||
VERIFY_VALUE_AND_OPS( native_16_t, int_least16_t, 0x7fff );
|
||||
VERIFY_VALUE_AND_OPS( native_16_t, int_least16_t, -0x8000 );
|
||||
VERIFY_NATIVE_REPRESENTATION( native_int16un_t );
|
||||
VERIFY_VALUE_AND_OPS( native_int16un_t, int_least16_t, 0x7fff );
|
||||
VERIFY_VALUE_AND_OPS( native_int16un_t, int_least16_t, -0x8000 );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native_24_t );
|
||||
VERIFY_VALUE_AND_OPS( native_24_t, int_least32_t, 0x7fffff );
|
||||
VERIFY_VALUE_AND_OPS( native_24_t, int_least32_t, -0x800000 );
|
||||
VERIFY_NATIVE_REPRESENTATION( native_int24un_t );
|
||||
VERIFY_VALUE_AND_OPS( native_int24un_t, int_least32_t, 0x7fffff );
|
||||
VERIFY_VALUE_AND_OPS( native_int24un_t, int_least32_t, -0x800000 );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native_32_t );
|
||||
VERIFY_VALUE_AND_OPS( native_32_t, int_least32_t, 0x7fffffff );
|
||||
VERIFY_VALUE_AND_OPS( native_32_t, int_least32_t, -0x7fffffff-1 );
|
||||
VERIFY_NATIVE_REPRESENTATION( native_int32un_t );
|
||||
VERIFY_VALUE_AND_OPS( native_int32un_t, int_least32_t, 0x7fffffff );
|
||||
VERIFY_VALUE_AND_OPS( native_int32un_t, int_least32_t, -0x7fffffff-1 );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native_40_t );
|
||||
VERIFY_VALUE_AND_OPS( native_40_t, int_least64_t, 0x7fffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( native_40_t, int_least64_t, -0x8000000000LL );
|
||||
VERIFY_NATIVE_REPRESENTATION( native_int40un_t );
|
||||
VERIFY_VALUE_AND_OPS( native_int40un_t, int_least64_t, 0x7fffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( native_int40un_t, int_least64_t, -0x8000000000LL );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native_48_t );
|
||||
VERIFY_VALUE_AND_OPS( native_48_t, int_least64_t, 0x7fffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( native_48_t, int_least64_t, -0x800000000000LL );
|
||||
VERIFY_NATIVE_REPRESENTATION( native_int48un_t );
|
||||
VERIFY_VALUE_AND_OPS( native_int48un_t, int_least64_t, 0x7fffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( native_int48un_t, int_least64_t, -0x800000000000LL );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native_56_t );
|
||||
VERIFY_VALUE_AND_OPS( native_56_t, int_least64_t, 0x7fffffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( native_56_t, int_least64_t, -0x80000000000000LL );
|
||||
VERIFY_NATIVE_REPRESENTATION( native_int56un_t );
|
||||
VERIFY_VALUE_AND_OPS( native_int56un_t, int_least64_t, 0x7fffffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( native_int56un_t, int_least64_t, -0x80000000000000LL );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native_64_t );
|
||||
VERIFY_VALUE_AND_OPS( native_64_t, int_least64_t, 0x7fffffffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( native_64_t, int_least64_t, -0x7fffffffffffffffLL-1 );
|
||||
VERIFY_NATIVE_REPRESENTATION( native_int64un_t );
|
||||
VERIFY_VALUE_AND_OPS( native_int64un_t, int_least64_t, 0x7fffffffffffffffLL );
|
||||
VERIFY_VALUE_AND_OPS( native_int64un_t, int_least64_t, -0x7fffffffffffffffLL-1 );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native_u8_t );
|
||||
VERIFY_VALUE_AND_OPS( native_u8_t, uint_least8_t, 0xff );
|
||||
VERIFY_NATIVE_REPRESENTATION( native_uint8un_t );
|
||||
VERIFY_VALUE_AND_OPS( native_uint8un_t, uint_least8_t, 0xff );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native_u16_t );
|
||||
VERIFY_VALUE_AND_OPS( native_u16_t, uint_least16_t, 0xffff );
|
||||
VERIFY_NATIVE_REPRESENTATION( native_uint16un_t );
|
||||
VERIFY_VALUE_AND_OPS( native_uint16un_t, uint_least16_t, 0xffff );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native_u24_t );
|
||||
VERIFY_VALUE_AND_OPS( native_u24_t, uint_least32_t, 0xffffff );
|
||||
VERIFY_NATIVE_REPRESENTATION( native_uint24un_t );
|
||||
VERIFY_VALUE_AND_OPS( native_uint24un_t, uint_least32_t, 0xffffff );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native_u32_t );
|
||||
VERIFY_VALUE_AND_OPS( native_u32_t, uint_least32_t, 0xffffffff );
|
||||
VERIFY_NATIVE_REPRESENTATION( native_uint32un_t );
|
||||
VERIFY_VALUE_AND_OPS( native_uint32un_t, uint_least32_t, 0xffffffff );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native_u40_t );
|
||||
VERIFY_VALUE_AND_OPS( native_u40_t, uint_least64_t, 0xffffffffffLL );
|
||||
VERIFY_NATIVE_REPRESENTATION( native_uint40un_t );
|
||||
VERIFY_VALUE_AND_OPS( native_uint40un_t, uint_least64_t, 0xffffffffffLL );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native_u48_t );
|
||||
VERIFY_VALUE_AND_OPS( native_u48_t, uint_least64_t, 0xffffffffffffLL );
|
||||
VERIFY_NATIVE_REPRESENTATION( native_uint48un_t );
|
||||
VERIFY_VALUE_AND_OPS( native_uint48un_t, uint_least64_t, 0xffffffffffffLL );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native_u56_t );
|
||||
VERIFY_VALUE_AND_OPS( native_u56_t, uint_least64_t, 0xffffffffffffffLL );
|
||||
VERIFY_NATIVE_REPRESENTATION( native_uint56un_t );
|
||||
VERIFY_VALUE_AND_OPS( native_uint56un_t, uint_least64_t, 0xffffffffffffffLL );
|
||||
|
||||
VERIFY_NATIVE_REPRESENTATION( native_u64_t );
|
||||
VERIFY_VALUE_AND_OPS( native_u64_t, uint_least64_t, 0xffffffffffffffffULL );
|
||||
VERIFY_NATIVE_REPRESENTATION( native_uint64un_t );
|
||||
VERIFY_VALUE_AND_OPS( native_uint64un_t, uint_least64_t, 0xffffffffffffffffULL );
|
||||
|
||||
// aligned integer types
|
||||
VERIFY_BIG_REPRESENTATION( big_int16_t );
|
||||
@ -864,9 +864,9 @@ namespace
|
||||
|
||||
void check_udt()
|
||||
{
|
||||
typedef boost::endian::endian< order::big, MyInt, 32 > mybig_32_t;
|
||||
typedef boost::endian::endian< order::big, MyInt, 32 > mybig_int32un_t;
|
||||
|
||||
mybig_32_t v(10);
|
||||
mybig_int32un_t v(10);
|
||||
cout << "+v is " << +v << endl;
|
||||
v += 1;
|
||||
cout << "v is " << +v << endl;
|
||||
@ -922,9 +922,9 @@ int cpp_main( int argc, char * argv[] )
|
||||
check_data();
|
||||
check_udt();
|
||||
|
||||
//timing_test<big_32_t> ( "big_32_t" );
|
||||
//timing_test<big_int32un_t> ( "big_int32un_t" );
|
||||
//timing_test<big_int32_t>( "big_int32_t" );
|
||||
//timing_test<little_32_t> ( "little_32_t" );
|
||||
//timing_test<little_int32un_t> ( "little_int32un_t" );
|
||||
//timing_test<little_int32_t>( "little_int32_t" );
|
||||
|
||||
cout << "\n" << err_count << " errors detected\nTest "
|
||||
|
Reference in New Issue
Block a user