From 05c1f883244bff0c8f1df56551bdca9d48a6d57c Mon Sep 17 00:00:00 2001
From: John Maddock
- 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 long long
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 not required in the boost header, and may not be
+ supplied for all platforms/compilers, because long long
+ is not [yet] included in the C++ standard.
See cstdint_test.cpp for @@ -66,13 +67,13 @@
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 boost
without placing any names in namespace
- std
. 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.
+ std
. 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.
Because these are boost headers, their names conform to boost header naming @@ -108,9 +109,9 @@ designates an unsigned integer type of exactly # bits.
- 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.
The absence of int64_t and uint64_t is indicated by the macro BOOST_NO_INT64_T
.
@@ -125,14 +126,14 @@
The typedef int_least#_t
, 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, int_least32_t
denotes a signed integer type with
- a width of at least 32 bits. Similarly, the typedef name uint_least#_t
+ Thus, int_least32_t
denotes the smallest signed integer
+ type with a width of at least 32 bits. Similarly, the typedef name uint_least#_t
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.
- Required minimum-width integer types: + The following minimum-width integer types are provided for all platforms:
int_least8_t
uint_least32_t
- The types: + The following types are available only if, after including <boost/cstdint.hpp>, + the macro BOOST_NO_INT64_T is not defined:
int_least64_t
uint_least64_t
- Are available only if, after inclusion of <boost/cstdint.hpp>
- the macro BOOST_NO_INT64_T
- is not defined.
-
All other minimum-width integer types are optional.
@@ -174,7 +171,7 @@ case, however, they satisfy the signedness and width requirements.- Required fastest minimum-width integer types: + The following fastest minimum-width integer types are provided for all platforms:
int_fast8_t
uint_fast32_t
- The types: + The following types are available only if, after including <boost/cstdint.hpp>, + the macro BOOST_NO_INT64_T is not defined:
int_fast64_t
uint_fast64_t
- Are available only if, after inclusion of <boost/cstdint.hpp>
- the macro BOOST_NO_INT64_T
- is not defined.
-
All other fastest minimum-width integer types are optional.
@@ -214,7 +207,7 @@ capable of representing any value of any unsigned integer type.- These types are required. + These types are provided for all platforms.
diff --git a/doc/html/boost_integer/history.html b/doc/html/boost_integer/history.html index 5e6c6e7..a1f76ff 100644 --- a/doc/html/boost_integer/history.html +++ b/doc/html/boost_integer/history.html @@ -26,7 +26,7 @@ Historyint
objects before processing. The input type, passed
as the only template parameter, must be a built-in integral type, except
bool
. Unsigned integral types can be used, as well as
- signed integral types, despite the name. The output type is given as the
- class member fast
.
+ signed integral types. The output type is given as the nested type fast
.
Implementation Notes: 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 int_t
, uint_t
, int_max_value_t
,
int_min_value_t
, and uint_value_t
class
templates find the most appropiate built-in integral type for the given template
- parameter. This type is given by the class member least
.
- The easiest-to-manipulate version of that type is given by the class member
+ parameter. This type is given by the nested type least
.
+ The easiest-to-manipulate version of that type is given by the nested type
fast
. The following table describes each template's criteria.
Table 1. Criteria for the Sized Type Class Templates
+Table 1. Criteria for the Sized Type Class Templates
- |
- The smallest built-in signed integral type with at least N + The smallest, built-in, signed integral type with at least N 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 exact - is defined only if there is a type - with exactly N bits. + of bits in the largest integer type. |
- |
- The smallest built-in unsigned integral type with at least N + The easiest-to-manipulate, built-in, signed integral type with at least + N 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. + + |
+
+
+ |
+
+ + A built-in, signed integral type with exactly N + bits, including the sign bit. The parameter should be a positive number. + Note that the member exact is defined only if there exists a type with exactly N + bits. + + |
+
+
+ |
+
+ + The smallest, built-in, unsigned integral type with at least N + 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. + + |
+
+
+ |
+
+ + The easiest-to-manipulate, built-in, unsigned integral type with at + least N 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. + + |
+
+
+ |
+
+ + A built-in, unsigned integral type with exactly N 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 exact is defined - only if there is a type with exactly + only if there exists a type with exactly N bits. |
@@ -196,45 +253,87 @@
- |
- The smallest built-in signed integral type that can hold all the values - in the inclusive range 0 - V. The parameter should - be a positive number. + The smallest, built-in, signed integral type that can hold all the + values in the inclusive range 0 - V. The parameter + should be a positive number. |
- |
- The smallest built-in signed integral type that can hold all the values - in the inclusive range V-0. 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 0 - V. + The parameter should be a positive number. |
- |
- 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 V - 0. 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 V - 0. + The parameter should be a negative number. + + |
+
+
+ |
+
+ + The smallest, built-in, unsigned integral type that can hold all positive values up to and including V. The parameter should be a positive number. |
+
+ |
+
+ + The easiest-to-manipulate, built-in, unsigned integral type that can + hold all positive values up to and including V. + The parameter should be a positive number. + + |
+
boost::static_log2
class template takes one template
parameter, a value of type static_log2_argument_type
.
The template only defines one member, value
, which gives
- the truncated base-two logarithm of the template argument.
+ the truncated, base-two logarithm of the template argument.
Since the logarithm of zero, for any base, is undefined, there is a specialization @@ -99,38 +98,6 @@
#include "boost/integer/static_log2.hpp" - - -template < boost::static_log2_argument_type value > -bool is_it_what() -{ - typedef boost::static_log2<value> lb_type; - - int temp = lb_type::value; - //... - return (temp % 2) != 0; -} - -//... - -int main() -{ - bool temp = is_it_what<2000>(); - //... -# if 0 - temp = is_it_what<0>(); // would give an error -# endif - //... - temp = is_it_what<24>(); - //... -} --
- The smallest unsigned built-in type that supports the given bit position. + The smallest, unsigned, built-in type that supports the given bit position. |
@@ -144,7 +144,7 @@
- The quick-to-manipulate analog of |
@@ -156,7 +156,7 @@
- A |
@@ -197,15 +197,14 @@
- The smallest unsigned built-in type that supports the given bit count. + The smallest, unsigned built-in type that supports the given bit count. |
@@ -244,7 +243,7 @@
- The quick-to-manipulate analog of |
diff --git a/doc/html/boost_integer/minmax.html b/doc/html/boost_integer/minmax.html
index fae12f2..7b1fea0 100644
--- a/doc/html/boost_integer/minmax.html
+++ b/doc/html/boost_integer/minmax.html
@@ -6,7 +6,7 @@
-
+
@@ -71,10 +71,10 @@
- Note: A flag is_integral
is provided, because a user-defined
+ Note: The is_integral flag is provided, because a user-defined
integer class should specialize std::numeric_limits<>::is_integer
- = true
, nonetheless compile-time constants const_min
- and const_max
cannot be provided for that user-defined
- class.
+ = true, while compile-time constants const_min
+ and const_max
are not provided for that user-defined class,
+ unless boost::integer_traits is also specialized.
Copyright © 2001 -2009 Beman Dawes, Daryle Walker, Gennaro Prota, John Maddock
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -56,7 +56,7 @@
- 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 min
and max
.
+ 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.
- Compile time log2 Calculation. + Compile time log2 Calculation. |
@@ -229,7 +237,7 @@
diff --git a/doc/integer.qbk b/doc/integer.qbk index 5417d3c..b9d9361 100644 --- a/doc/integer.qbk +++ b/doc/integer.qbk @@ -15,7 +15,13 @@ [section:overview Overview] -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 |