mirror of
https://github.com/boostorg/integer.git
synced 2025-07-19 15:32:11 +02:00
Fix issues in docs.
[SVN r58008]
This commit is contained in:
@ -49,10 +49,11 @@
|
||||
integer widths. All typedef's are in namespace boost.
|
||||
</p>
|
||||
<p>
|
||||
The specifications are based on the ISO/IEC 9899:1999 C Language standard
|
||||
header <stdint.h>. The 64-bit types required by the C standard are
|
||||
not required in the boost header, and may not be supplied in all implementations,
|
||||
because <code class="literal">long long</code> is not [yet] included in the C++ standard.
|
||||
The specifications for these types are based on the ISO/IEC 9899:1999 C Language
|
||||
standard header <stdint.h>. The 64-bit types required by the C standard
|
||||
are <span class="emphasis"><em>not required</em></span> in the boost header, and may not be
|
||||
supplied for all platforms/compilers, because <code class="literal">long long</code>
|
||||
is not [yet] included in the C++ standard.
|
||||
</p>
|
||||
<p>
|
||||
See <a href="../../../test/cstdint_test.cpp" target="_top">cstdint_test.cpp</a> for
|
||||
@ -66,13 +67,13 @@
|
||||
<p>
|
||||
The organization of the Boost.Integer headers and classes is designed to
|
||||
take advantage of <stdint.h> types from the 1999 C standard without
|
||||
resorting to undefined behavior in terms of the 1998 C++ standard. The header
|
||||
causing undefined behavior in terms of the 1998 C++ standard. The header
|
||||
<boost/cstdint.hpp> makes the standard integer types safely available
|
||||
in namespace <code class="literal">boost</code> without placing any names in namespace
|
||||
<code class="literal">std</code>. As always, the intension is to complement rather
|
||||
than compete with the C++ Standard Library. Should some future C++ standard
|
||||
include <stdint.h> and <cstdint>, then <boost/cstdint.hpp>
|
||||
will continue to function, but will become redundant and may be safely deprecated.
|
||||
<code class="literal">std</code>. The intension is to complement rather than compete
|
||||
with the C++ Standard Library. Should some future C++ standard include <stdint.h>
|
||||
and <cstdint>, then <boost/cstdint.hpp> will continue to function,
|
||||
but will become redundant and may be safely deprecated.
|
||||
</p>
|
||||
<p>
|
||||
Because these are boost headers, their names conform to boost header naming
|
||||
@ -108,9 +109,9 @@
|
||||
designates an unsigned integer type of exactly # bits.
|
||||
</p>
|
||||
<p>
|
||||
These types are optional. However, if an implementation provides integer
|
||||
types with widths of 8, 16, 32, or 64 bits, it shall define the corresponding
|
||||
typedef names.
|
||||
These types are optional. However, if a platform supports integer types with
|
||||
widths of 8, 16, 32, 64, or any combination thereof, then <boost/cstdint.hpp>
|
||||
does provide the corresponding typedefs.
|
||||
</p>
|
||||
<p>
|
||||
The absence of int64_t and uint64_t is indicated by the macro <code class="computeroutput"><span class="identifier">BOOST_NO_INT64_T</span></code>.
|
||||
@ -125,14 +126,14 @@
|
||||
The typedef <code class="literal">int_least#_t</code>, with # replaced by the width,
|
||||
designates a signed integer type with a width of at least # bits, such that
|
||||
no signed integer type with lesser size has at least the specified width.
|
||||
Thus, <code class="literal">int_least32_t</code> denotes a signed integer type with
|
||||
a width of at least 32 bits. Similarly, the typedef name <code class="literal">uint_least#_t</code>
|
||||
Thus, <code class="literal">int_least32_t</code> denotes the smallest signed integer
|
||||
type with a width of at least 32 bits. Similarly, the typedef name <code class="literal">uint_least#_t</code>
|
||||
designates an unsigned integer type with a width of at least # bits, such
|
||||
that no unsigned integer type with lesser size has at least the specified
|
||||
width.
|
||||
</p>
|
||||
<p>
|
||||
Required minimum-width integer types:
|
||||
The following minimum-width integer types are provided for all platforms:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li><code class="literal">int_least8_t</code></li>
|
||||
@ -143,17 +144,13 @@
|
||||
<li><code class="literal">uint_least32_t</code></li>
|
||||
</ul></div>
|
||||
<p>
|
||||
The types:
|
||||
The following types are available only if, after including <boost/cstdint.hpp>,
|
||||
the macro BOOST_NO_INT64_T is not defined:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li><code class="literal">int_least64_t</code></li>
|
||||
<li><code class="literal">uint_least64_t</code></li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Are available only if, after inclusion of <code class="literal"><boost/cstdint.hpp></code>
|
||||
the macro <code class="computeroutput"><span class="identifier">BOOST_NO_INT64_T</span></code>
|
||||
is <span class="emphasis"><em><span class="bold"><strong>not defined</strong></span></em></span>.
|
||||
</p>
|
||||
<p>
|
||||
All other minimum-width integer types are optional.
|
||||
</p>
|
||||
@ -174,7 +171,7 @@
|
||||
case, however, they satisfy the signedness and width requirements.
|
||||
</p>
|
||||
<p>
|
||||
Required fastest minimum-width integer types:
|
||||
The following fastest minimum-width integer types are provided for all platforms:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li><code class="literal">int_fast8_t</code></li>
|
||||
@ -185,17 +182,13 @@
|
||||
<li><code class="literal">uint_fast32_t</code></li>
|
||||
</ul></div>
|
||||
<p>
|
||||
The types:
|
||||
The following types are available only if, after including <boost/cstdint.hpp>,
|
||||
the macro BOOST_NO_INT64_T is not defined:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
<li><code class="literal">int_fast64_t</code></li>
|
||||
<li><code class="literal">uint_fast64_t</code></li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Are available only if, after inclusion of <code class="literal"><boost/cstdint.hpp></code>
|
||||
the macro <code class="computeroutput"><span class="identifier">BOOST_NO_INT64_T</span></code>
|
||||
is <span class="emphasis"><em><span class="bold"><strong>not defined</strong></span></em></span>.
|
||||
</p>
|
||||
<p>
|
||||
All other fastest minimum-width integer types are optional.
|
||||
</p>
|
||||
@ -214,7 +207,7 @@
|
||||
capable of representing any value of any unsigned integer type.
|
||||
</p>
|
||||
<p>
|
||||
These types are required.
|
||||
These types are provided for all platforms.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -26,7 +26,7 @@
|
||||
<a name="boost_integer.history"></a><a class="link" href="history.html" title="History"> History</a>
|
||||
</h2></div></div></div>
|
||||
<a name="boost_integer.history.1_42_0"></a><h5>
|
||||
<a name="id773547"></a>
|
||||
<a name="id768488"></a>
|
||||
<a class="link" href="history.html#boost_integer.history.1_42_0">1.42.0</a>
|
||||
</h5>
|
||||
<div class="itemizedlist"><ul type="disc">
|
||||
@ -55,7 +55,7 @@
|
||||
</li>
|
||||
</ul></div>
|
||||
<a name="boost_integer.history.1_32_0"></a><h5>
|
||||
<a name="id773649"></a>
|
||||
<a name="id768590"></a>
|
||||
<a class="link" href="history.html#boost_integer.history.1_32_0">1.32.0</a>
|
||||
</h5>
|
||||
<div class="itemizedlist"><ul type="disc"><li>
|
||||
|
@ -54,7 +54,7 @@
|
||||
</span> <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">LeastInt</span><span class="special">></span>
|
||||
<span class="keyword">struct</span> <span class="identifier">int_fast_t</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">typedef</span> <span class="emphasis"><em>implementation-defined-type</em></span> <span class="identifier">fast</span><span class="special">;</span>
|
||||
<span class="keyword">typedef</span> <span class="emphasis"><em>implementation-defined-type</em></span> <span class="identifier">type</span><span class="special">;</span>
|
||||
<span class="special">};</span>
|
||||
|
||||
<span class="comment">// signed
|
||||
@ -115,13 +115,12 @@
|
||||
to <code class="literal">int</code> objects before processing. The input type, passed
|
||||
as the only template parameter, must be a built-in integral type, except
|
||||
<code class="literal">bool</code>. Unsigned integral types can be used, as well as
|
||||
signed integral types, despite the name. The output type is given as the
|
||||
class member <code class="literal">fast</code>.
|
||||
signed integral types. The output type is given as the nested type <code class="literal">fast</code>.
|
||||
</p>
|
||||
<p>
|
||||
<span class="bold"><strong>Implementation Notes:</strong></span> By default, the output
|
||||
type is identical to the input type. Eventually, this code's implementation
|
||||
should be conditionalized for each platform to give accurate mappings between
|
||||
should be customized for each platform to give accurate mappings between
|
||||
the built-in types and the easiest-to-manipulate built-in types. Also, there
|
||||
is no guarantee that the output type actually is easier to manipulate than
|
||||
the input type.
|
||||
@ -135,12 +134,12 @@
|
||||
The <code class="literal">int_t</code>, <code class="literal">uint_t</code>, <code class="literal">int_max_value_t</code>,
|
||||
<code class="literal">int_min_value_t</code>, and <code class="literal">uint_value_t</code> class
|
||||
templates find the most appropiate built-in integral type for the given template
|
||||
parameter. This type is given by the class member <code class="literal">least</code>.
|
||||
The easiest-to-manipulate version of that type is given by the class member
|
||||
parameter. This type is given by the nested type <code class="literal">least</code>.
|
||||
The easiest-to-manipulate version of that type is given by the nested type
|
||||
<code class="literal">fast</code>. The following table describes each template's criteria.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id768468"></a><p class="title"><b>Table 1. Criteria for the Sized Type Class Templates</b></p>
|
||||
<a name="id764075"></a><p class="title"><b>Table 1. Criteria for the Sized Type Class Templates</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Criteria for the Sized Type Class Templates">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -162,33 +161,91 @@
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="literal">boost::int_t<N></code>
|
||||
<code class="literal">boost::int_t<N>::least</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The smallest built-in signed integral type with at least <span class="emphasis"><em>N</em></span>
|
||||
The smallest, built-in, signed integral type with at least <span class="emphasis"><em>N</em></span>
|
||||
bits, including the sign bit. The parameter should be a positive number.
|
||||
A compile-time error results if the parameter is larger than the number
|
||||
of bits in the largest integer type. Note that the member <span class="emphasis"><em>exact</em></span>
|
||||
is defined <span class="bold"><strong>only</strong></span> if there is a type
|
||||
with exactly N bits.
|
||||
of bits in the largest integer type.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="literal">boost::uint_t<N></code>
|
||||
<code class="literal">boost::int_t<N>::fast</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The smallest built-in unsigned integral type with at least <span class="emphasis"><em>N</em></span>
|
||||
The easiest-to-manipulate, built-in, signed integral type with at least
|
||||
<span class="emphasis"><em>N</em></span> bits, including the sign bit. The parameter
|
||||
should be a positive number. A compile-time error results if the parameter
|
||||
is larger than the number of bits in the largest integer type.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="literal">boost::int_t<N>::exact</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
A built-in, signed integral type with exactly <span class="emphasis"><em>N</em></span>
|
||||
bits, including the sign bit. The parameter should be a positive number.
|
||||
Note that the member <span class="emphasis"><em>exact</em></span> is defined <span class="bold"><strong>only</strong></span> if there exists a type with exactly <span class="emphasis"><em>N</em></span>
|
||||
bits.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="literal">boost::uint_t<N>::least</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The smallest, built-in, unsigned integral type with at least <span class="emphasis"><em>N</em></span>
|
||||
bits. The parameter should be a positive number. A compile-time error
|
||||
results if the parameter is larger than the number of bits in the largest
|
||||
integer type.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="literal">boost::uint_t<N>::fast</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The easiest-to-manipulate, built-in, unsigned integral type with at
|
||||
least <span class="emphasis"><em>N</em></span> bits. The parameter should be a positive
|
||||
number. A compile-time error results if the parameter is larger than
|
||||
the number of bits in the largest integer type.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="literal">boost::uint_t<N>::exact</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
A built-in, unsigned integral type with exactly <span class="emphasis"><em>N</em></span>
|
||||
bits. The parameter should be a positive number. A compile-time error
|
||||
results if the parameter is larger than the number of bits in the largest
|
||||
integer type. Note that the member <span class="emphasis"><em>exact</em></span> is defined
|
||||
<span class="bold"><strong>only</strong></span> if there is a type with exactly
|
||||
<span class="bold"><strong>only</strong></span> if there exists a type with exactly
|
||||
N bits.
|
||||
</p>
|
||||
</td>
|
||||
@ -196,45 +253,87 @@
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="literal">boost::int_max_value_t<V></code>
|
||||
<code class="literal">boost::int_max_value_t<V>::last</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The smallest built-in signed integral type that can hold all the values
|
||||
in the inclusive range <span class="emphasis"><em>0 - V</em></span>. The parameter should
|
||||
be a positive number.
|
||||
The smallest, built-in, signed integral type that can hold all the
|
||||
values in the inclusive range <span class="emphasis"><em>0 - V</em></span>. The parameter
|
||||
should be a positive number.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="literal">boost::int_min_value_t<V></code>
|
||||
<code class="literal">boost::int_max_value_t<V>::fast</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The smallest built-in signed integral type that can hold all the values
|
||||
in the inclusive range <span class="emphasis"><em>V-0</em></span>. The parameter should
|
||||
be a negative number.
|
||||
The easiest-to-manipulate, built-in, signed integral type that can
|
||||
hold all the values in the inclusive range <span class="emphasis"><em>0 - V</em></span>.
|
||||
The parameter should be a positive number.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="literal">boost::uint_value_t<V></code>
|
||||
<code class="literal">boost::int_min_value_t<V>::least</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The smallest built-in unsigned integral type that can hold all positive
|
||||
The smallest, built-in, signed integral type that can hold all the
|
||||
values in the inclusive range <span class="emphasis"><em>V - 0</em></span>. The parameter
|
||||
should be a negative number.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="literal">boost::int_min_value_t<V>::fast</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The easiest-to-manipulate, built-in, signed integral type that can
|
||||
hold all the values in the inclusive range <span class="emphasis"><em>V - 0</em></span>.
|
||||
The parameter should be a negative number.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="literal">boost::uint_value_t<V>::least</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The smallest, built-in, unsigned integral type that can hold all positive
|
||||
values up to and including <span class="emphasis"><em>V</em></span>. The parameter should
|
||||
be a positive number.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="literal">boost::uint_value_t<V>::fast</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The easiest-to-manipulate, built-in, unsigned integral type that can
|
||||
hold all positive values up to and including <span class="emphasis"><em>V</em></span>.
|
||||
The parameter should be a positive number.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Compile time log2 Calculation</title>
|
||||
<title>Compile Time log2 Calculation</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<link rel="home" href="../index.html" title="Boost.Integer">
|
||||
@ -24,12 +24,11 @@
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_integer.log2"></a><a class="link" href="log2.html" title="Compile time log2 Calculation"> Compile time log2 Calculation</a>
|
||||
<a name="boost_integer.log2"></a><a class="link" href="log2.html" title="Compile Time log2 Calculation"> Compile Time log2 Calculation</a>
|
||||
</h2></div></div></div>
|
||||
<div class="toc"><dl>
|
||||
<dt><span class="section"><a href="log2.html#boost_integer.log2.synopsis">Synopsis</a></span></dt>
|
||||
<dt><span class="section"><a href="log2.html#boost_integer.log2.usage">Usage</a></span></dt>
|
||||
<dt><span class="section"><a href="log2.html#boost_integer.log2.example">Example</a></span></dt>
|
||||
<dt><span class="section"><a href="log2.html#boost_integer.log2.demonstration_program">Demonstration
|
||||
Program</a></span></dt>
|
||||
<dt><span class="section"><a href="log2.html#boost_integer.log2.rationale">Rationale</a></span></dt>
|
||||
@ -75,7 +74,7 @@
|
||||
The <code class="literal">boost::static_log2</code> class template takes one template
|
||||
parameter, a value of type <code class="literal">static_log2_argument_type</code>.
|
||||
The template only defines one member, <code class="literal">value</code>, which gives
|
||||
the truncated base-two logarithm of the template argument.
|
||||
the truncated, base-two logarithm of the template argument.
|
||||
</p>
|
||||
<p>
|
||||
Since the logarithm of zero, for any base, is undefined, there is a specialization
|
||||
@ -99,38 +98,6 @@
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_integer.log2.example"></a><a class="link" href="log2.html#boost_integer.log2.example" title="Example">Example</a>
|
||||
</h3></div></div></div>
|
||||
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="string">"boost/integer/static_log2.hpp"</span>
|
||||
|
||||
|
||||
<span class="keyword">template</span> <span class="special"><</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">static_log2_argument_type</span> <span class="identifier">value</span> <span class="special">></span>
|
||||
<span class="keyword">bool</span> <span class="identifier">is_it_what</span><span class="special">()</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">static_log2</span><span class="special"><</span><span class="identifier">value</span><span class="special">></span> <span class="identifier">lb_type</span><span class="special">;</span>
|
||||
|
||||
<span class="keyword">int</span> <span class="identifier">temp</span> <span class="special">=</span> <span class="identifier">lb_type</span><span class="special">::</span><span class="identifier">value</span><span class="special">;</span>
|
||||
<span class="comment">//...
|
||||
</span> <span class="keyword">return</span> <span class="special">(</span><span class="identifier">temp</span> <span class="special">%</span> <span class="number">2</span><span class="special">)</span> <span class="special">!=</span> <span class="number">0</span><span class="special">;</span>
|
||||
<span class="special">}</span>
|
||||
|
||||
<span class="comment">//...
|
||||
</span>
|
||||
<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">bool</span> <span class="identifier">temp</span> <span class="special">=</span> <span class="identifier">is_it_what</span><span class="special"><</span><span class="number">2000</span><span class="special">>();</span>
|
||||
<span class="comment">//...
|
||||
</span><span class="preprocessor"># if</span> <span class="number">0</span>
|
||||
<span class="identifier">temp</span> <span class="special">=</span> <span class="identifier">is_it_what</span><span class="special"><</span><span class="number">0</span><span class="special">>();</span> <span class="comment">// would give an error
|
||||
</span><span class="preprocessor"># endif</span>
|
||||
<span class="comment">//...
|
||||
</span> <span class="identifier">temp</span> <span class="special">=</span> <span class="identifier">is_it_what</span><span class="special"><</span><span class="number">24</span><span class="special">>();</span>
|
||||
<span class="comment">//...
|
||||
</span><span class="special">}</span>
|
||||
</pre>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="boost_integer.log2.demonstration_program"></a><a class="link" href="log2.html#boost_integer.log2.demonstration_program" title="Demonstration Program">Demonstration
|
||||
Program</a>
|
||||
</h3></div></div></div>
|
||||
@ -150,7 +117,7 @@
|
||||
can be considered the highest power-of-two in a value, which corresponds
|
||||
to the value's highest set bit (for binary integers). Sometimes the highest-bit
|
||||
position could be used in generic programming, which requires the position
|
||||
to be statically (<span class="emphasis"><em>i.e.</em></span> at compile-time) available.
|
||||
to be available statically (<span class="emphasis"><em>i.e.</em></span> at compile-time).
|
||||
</p>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
|
@ -7,7 +7,7 @@
|
||||
<link rel="home" href="../index.html" title="Boost.Integer">
|
||||
<link rel="up" href="../index.html" title="Boost.Integer">
|
||||
<link rel="prev" href="integer.html" title="Integer Type Selection">
|
||||
<link rel="next" href="log2.html" title="Compile time log2 Calculation">
|
||||
<link rel="next" href="log2.html" title="Compile Time log2 Calculation">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
@ -105,7 +105,7 @@
|
||||
of <code class="literal">high_bit_mask_t</code>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id769480"></a><p class="title"><b>Table 2. Members of the `boost::high_bit_mask_t` Class Template</b></p>
|
||||
<a name="id765275"></a><p class="title"><b>Table 2. Members of the `boost::high_bit_mask_t` Class Template</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Members of the `boost::high_bit_mask_t` Class Template">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -132,7 +132,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The smallest unsigned built-in type that supports the given bit position.
|
||||
The smallest, unsigned, built-in type that supports the given bit position.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
@ -144,7 +144,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The quick-to-manipulate analog of <code class="literal">least</code>.
|
||||
The easiest-to-manipulate analog of <code class="literal">least</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
@ -156,7 +156,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
A <code class="literal">least</code> constant of the desired bit-masking value.
|
||||
A <code class="literal">least</code> constant of the value 2<sup>Bit</sup>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
@ -197,15 +197,14 @@
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
The <code class="literal">boost::low_bits_mask_t</code> class template provides constants
|
||||
for bit masks representing the lowest bits of a certain amount. The masks
|
||||
are equivalent to the value (2<sup>Bits</sup> - 1), where <code class="literal">Bits</code> is
|
||||
the template parameter. The bit amount must be a nonnegative number from
|
||||
zero to <span class="emphasis"><em>Max</em></span>, where Max is the number of bits supported
|
||||
by the largest unsigned built-in integral type. The following table describes
|
||||
the members of an instantiation of <code class="literal">low_bits_mask_t</code>.
|
||||
for bit masks equivalent to the value (2<sup>Bits</sup> - 1), where <code class="literal">Bits</code>
|
||||
is the template parameter. The parameter <code class="literal">Bits</code> must be
|
||||
a non-negative integer from zero to <span class="emphasis"><em>Max</em></span>, where Max is
|
||||
the number of bits supported by the largest, unsigned, built-in integral
|
||||
type. The following table describes the members of <code class="literal">low_bits_mask_t</code>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="id769682"></a><p class="title"><b>Table 3. Members of the [^boost::low_bits_mask_t] Class Template</b></p>
|
||||
<a name="id765484"></a><p class="title"><b>Table 3. Members of the [^boost::low_bits_mask_t] Class Template</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Members of the [^boost::low_bits_mask_t] Class Template">
|
||||
<colgroup>
|
||||
<col>
|
||||
@ -232,7 +231,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The smallest unsigned built-in type that supports the given bit count.
|
||||
The smallest, unsigned built-in type that supports the given bit count.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
@ -244,7 +243,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The quick-to-manipulate analog of <code class="literal">least</code>.
|
||||
The easiest-to-manipulate analog of <code class="literal">least</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||||
<link rel="home" href="../index.html" title="Boost.Integer">
|
||||
<link rel="up" href="../index.html" title="Boost.Integer">
|
||||
<link rel="prev" href="log2.html" title="Compile time log2 Calculation">
|
||||
<link rel="prev" href="log2.html" title="Compile Time log2 Calculation">
|
||||
<link rel="next" href="history.html" title="History">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
@ -71,10 +71,10 @@
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
The four class templates provide the combinations for finding the minimum
|
||||
or maximum of two signed or <code class="literal">unsigned</code> (<code class="literal">long</code>)
|
||||
parameters, Value1 and Value2, at compile-time. Each template has a single
|
||||
static data member, <code class="literal">value</code>, which is set to the respective
|
||||
minimum or maximum of the template's parameters.
|
||||
or maximum of two <code class="literal">signed</code> or <code class="literal">unsigned</code>
|
||||
(<code class="literal">long</code>) parameters, <span class="emphasis"><em>Value1</em></span> and <span class="emphasis"><em>Value2</em></span>,
|
||||
at compile-time. Each template has a single static data member, <code class="literal">value</code>,
|
||||
which is set to the respective minimum or maximum of the template's parameters.
|
||||
</p>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
|
@ -70,6 +70,7 @@
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
|
||||
<span class="keyword">class</span> <span class="identifier">integer_traits</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span>
|
||||
<span class="special">{</span>
|
||||
<span class="keyword">public</span><span class="special">:</span>
|
||||
<span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">bool</span> <span class="identifier">is_integral</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">;</span>
|
||||
<span class="comment">//
|
||||
</span> <span class="comment">// These members are defined only if T is a built-in
|
||||
@ -87,9 +88,9 @@
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
Template class <code class="literal">integer_traits</code> is derived from <code class="literal">std::numeric_limits</code>.
|
||||
In general, it adds the single <code class="literal">bool</code> member <code class="literal">is_integral</code>
|
||||
with the compile-time constant value <code class="literal">false</code>. However, for
|
||||
all integral types <code class="literal">T</code> (std::3.9.1/7 [basic.fundamental]),
|
||||
The primary specialization adds the single <code class="literal">bool</code> member
|
||||
<code class="literal">is_integral</code> with the compile-time constant value <code class="literal">false</code>.
|
||||
However, for all integral types <code class="literal">T</code> (std::3.9.1/7 [basic.fundamental]),
|
||||
there are specializations provided with the following compile-time constants
|
||||
defined:
|
||||
</p>
|
||||
@ -171,11 +172,11 @@
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
Note: A flag <code class="literal">is_integral</code> is provided, because a user-defined
|
||||
Note: The <span class="emphasis"><em>is_integral</em></span> flag is provided, because a user-defined
|
||||
integer class should specialize <code class="literal">std::numeric_limits<>::is_integer
|
||||
= true</code>, nonetheless compile-time constants <code class="literal">const_min</code>
|
||||
and <code class="literal">const_max</code> cannot be provided for that user-defined
|
||||
class.
|
||||
= true</code>, while compile-time constants <code class="literal">const_min</code>
|
||||
and <code class="literal">const_max</code> are not provided for that user-defined class,
|
||||
unless boost::integer_traits is also specialized.
|
||||
</p>
|
||||
</div>
|
||||
<div class="section" lang="en">
|
||||
|
@ -40,7 +40,7 @@
|
||||
<div><p class="copyright">Copyright © 2001 -2009 Beman Dawes, Daryle Walker, Gennaro Prota,
|
||||
John Maddock</p></div>
|
||||
<div><div class="legalnotice">
|
||||
<a name="id758110"></a><p>
|
||||
<a name="id753741"></a><p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
@ -56,7 +56,7 @@
|
||||
<dt><span class="section"><a href="boost_integer/traits.html"> Integer Traits</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_integer/integer.html"> Integer Type Selection</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_integer/mask.html"> Integer Masks</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_integer/log2.html"> Compile time log2 Calculation</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_integer/log2.html"> Compile Time log2 Calculation</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_integer/minmax.html"> Compile time min/max calculation</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_integer/history.html"> History</a></span></dt>
|
||||
</dl>
|
||||
@ -66,7 +66,15 @@
|
||||
<a name="boost_integer.overview"></a><a class="link" href="index.html#boost_integer.overview" title="Overview"> Overview</a>
|
||||
</h2></div></div></div>
|
||||
<p>
|
||||
Boost.Integer consists of the following components:
|
||||
Boost.Integer provides integer type support, particularly helpful in generic
|
||||
programming. It provides standard C99 integer types, such as might be found
|
||||
in <stdint.h>, without requiring that header. It provides the means to
|
||||
select an integer type based upon its properties, like the number of bits or
|
||||
the maximum supported value, as well as compile-time bit mask selection. There
|
||||
is a derivative of std::numeric_limits that provides integral constant expressions
|
||||
for <code class="computeroutput"><span class="identifier">min</span></code> and <code class="computeroutput"><span class="identifier">max</span></code>.
|
||||
Finally, it provides two compile-time algorithms: determining the highest power
|
||||
of two in a compile-time value; and computing min and max of constant expressions.
|
||||
</p>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
@ -191,7 +199,7 @@
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="boost_integer/log2.html" title="Compile time log2 Calculation">Compile time log2 Calculation</a>.
|
||||
<a class="link" href="boost_integer/log2.html" title="Compile Time log2 Calculation">Compile time log2 Calculation</a>.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
@ -229,7 +237,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"><p><small>Last revised: November 27, 2009 at 11:11:24 GMT</small></p></td>
|
||||
<td align="left"><p><small>Last revised: November 28, 2009 at 17:06:38 GMT</small></p></td>
|
||||
<td align="right"><div class="copyright-footer"></div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
|
Reference in New Issue
Block a user