mirror of
https://github.com/boostorg/integer.git
synced 2025-06-26 12:31:40 +02:00
Compare commits
1 Commits
svn-branch
...
svn-branch
Author | SHA1 | Date | |
---|---|---|---|
26f7ec0bd8 |
11
cstdint.htm
11
cstdint.htm
@ -2,7 +2,7 @@
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
||||
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
|
||||
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
|
||||
<meta name="ProgId" content="FrontPage.Editor.Document">
|
||||
<title>Header boost/cstdint.hpp</title>
|
||||
</head>
|
||||
@ -69,13 +69,10 @@ representing any value of any signed integer type.</p>
|
||||
capable of representing any value of any unsigned integer type.</p>
|
||||
<p>These types are required.</p>
|
||||
<hr>
|
||||
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan -->06 Nov 2007<!--webbot bot="Timestamp" endspan i-checksum="15272" -->
|
||||
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan -->19 Aug 2001<!--webbot bot="Timestamp" endspan i-checksum="14767" -->
|
||||
</p>
|
||||
<p><EFBFBD> Copyright Beman Dawes 2000</p>
|
||||
|
||||
<p>Distributed under the Boost Software License, Version 1.0. See
|
||||
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
|
||||
<p> </p>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
@ -196,7 +196,7 @@ contaimination of values by the higher, unused bits.</p>
|
||||
<h2><a name="credits">Credits</a></h2>
|
||||
|
||||
<p>The author of the Boost bit mask class templates is <a
|
||||
href="http://www.boost.org/people/daryle_walker.html">Daryle Walker</a>.</p>
|
||||
href="../../../people/daryle_walker.html">Daryle Walker</a>.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
|
@ -186,7 +186,7 @@ code (and update old code as soon as possible).
|
||||
|
||||
|
||||
<p>The original version of the Boost binary logarithm class template was
|
||||
written by <a href="http://www.boost.org/people/daryle_walker.html">Daryle Walker</a>
|
||||
written by <a href="../../../people/daryle_walker.html">Daryle Walker</a>
|
||||
and then enhanced by Giovanni Bajo with support for compilers without
|
||||
partial template specialization. The current version was suggested,
|
||||
together with a reference implementation, by Vesa Karvonen. Gennaro Prota
|
||||
|
@ -106,7 +106,7 @@ class template.</p>
|
||||
<h2><a name="credits">Credits</a></h2>
|
||||
|
||||
<p>The author of the Boost compile-time extrema class templates is <a
|
||||
href="http://www.boost.org/people/daryle_walker.html">Daryle Walker</a>.</p>
|
||||
href="../../../people/daryle_walker.html">Daryle Walker</a>.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
|
@ -34,7 +34,7 @@ namespace boost
|
||||
template< int Category > struct int_least_helper {}; // default is empty
|
||||
|
||||
// specializatons: 1=long, 2=int, 3=short, 4=signed char,
|
||||
// 6=unsigned long, 7=unsigned int, 8=unsigned short, 9=unsigned char
|
||||
// 6=unsigned long, 7=unsigned int, 8=unsigned short, 9=unsigned long
|
||||
// no specializations for 0 and 5: requests for a type > long are in error
|
||||
template<> struct int_least_helper<1> { typedef long least; };
|
||||
template<> struct int_least_helper<2> { typedef int least; };
|
||||
|
13
index.html
13
index.html
@ -10,8 +10,8 @@
|
||||
<td bgcolor="white"><img src="../../boost.png" alt="boost.png (6897 bytes)" width="277" height="86"></td>
|
||||
<td><a href="../../index.htm"><font face="Arial" color="white"><big>Home</big></font></a></td>
|
||||
<td><a href="../libraries.htm"><font face="Arial" color="white"><big>Libraries</big></font></a></td>
|
||||
<td><a href="http://www.boost.org/people/people.htm"><font face="Arial" color="white"><big>People</big></font></a></td>
|
||||
<td><a href="http://www.boost.org/more/faq.htm"><font face="Arial" color="white"><big>FAQ</big></font></a></td>
|
||||
<td><a href="../../people/people.htm"><font face="Arial" color="white"><big>People</big></font></a></td>
|
||||
<td><a href="../../more/faq.htm"><font face="Arial" color="white"><big>FAQ</big></font></a></td>
|
||||
<td><a href="../../more/index.htm"><font face="Arial" color="white"><big>More</big></font></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -121,13 +121,8 @@ instead.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<p>Revised: <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %b %Y" startspan -->06 Nov 2007<!--webbot bot="Timestamp" endspan i-checksum="15272" -->
|
||||
<p>Revised: <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %b %Y" startspan -->03 Oct 2001<!--webbot bot="Timestamp" endspan i-checksum="14373" -->
|
||||
</p>
|
||||
|
||||
<p><EFBFBD> Copyright Beman Dawes 2003</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>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
10
integer.htm
10
integer.htm
@ -193,11 +193,11 @@ href="../../boost/cstdint.hpp"><boost/cstdint.hpp></a></cite>.</p>
|
||||
<h2><a name="credits">Credits</a></h2>
|
||||
|
||||
<p>The author of most of the Boost integer type choosing templates is <a
|
||||
href="http://www.boost.org/people/beman_dawes.html">Beman Dawes</a>. He gives thanks
|
||||
href="../../people/beman_dawes.html">Beman Dawes</a>. He gives thanks
|
||||
to Valentin Bonnard and
|
||||
<a href="http://www.boost.org/people/kevlin_henney.htm"> Kevlin Henney</a> for sharing
|
||||
<a href="../../people/kevlin_henney.htm"> Kevlin Henney</a> for sharing
|
||||
their designs for similar templates. <a
|
||||
href="http://www.boost.org/people/daryle_walker.html">Daryle Walker</a> designed the
|
||||
href="../../people/daryle_walker.html">Daryle Walker</a> designed the
|
||||
value-based sized templates.</p>
|
||||
|
||||
<hr>
|
||||
@ -206,7 +206,7 @@ value-based sized templates.</p>
|
||||
|
||||
<p>© Copyright Beman Dawes 1999. Use, modification, and distribution are
|
||||
subject to the Boost Software License, Version 1.0. (See accompanying file <a
|
||||
href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or a copy at <<a
|
||||
href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or a copy at <<a
|
||||
href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>>.)</p>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
@ -12,12 +12,11 @@
|
||||
// 10 Mar 01 Boost Test Library now used for tests (Beman Dawes)
|
||||
// 31 Aug 99 Initial version
|
||||
|
||||
#define BOOST_TEST_MODULE "Integer size-selection tests"
|
||||
|
||||
#include <boost/test/unit_test.hpp> // unit testing framework
|
||||
#include <boost/test/minimal.hpp> // for main, BOOST_CHECK
|
||||
|
||||
#include <boost/config.hpp> // for BOOST_NO_USING_TEMPLATE
|
||||
#include <boost/integer.hpp> // for boost::int_t, boost::uint_t, etc.
|
||||
#include <boost/cstdlib.hpp> // for boost::exit_success
|
||||
#include <boost/integer.hpp> // for boost::int_t, boost::uint_t
|
||||
|
||||
#include <climits> // for ULONG_MAX, LONG_MAX, LONG_MIN
|
||||
#include <iostream> // for std::cout (std::endl indirectly)
|
||||
@ -129,7 +128,7 @@ namespace boost
|
||||
|
||||
|
||||
// Test if a constant can fit within a certain type
|
||||
#define PRIVATE_FIT_TEST(Template, Number, Type, Value) BOOST_CHECK_EQUAL( Template < Number > :: Type ( Value ) , Value )
|
||||
#define PRIVATE_FIT_TEST(Template, Number, Type, Value) BOOST_CHECK( Template < Number > :: Type ( Value ) == Value )
|
||||
|
||||
#if ULONG_MAX > 0xFFFFFFFFL
|
||||
#define PRIVATE_FIT_TESTS(Template, Type, ValType, InitVal) do { ValType v = InitVal ; \
|
||||
@ -187,7 +186,7 @@ namespace boost
|
||||
PRIVATE_FIT_TEST(Template, 1, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 0, Type, v); } while ( false )
|
||||
#endif
|
||||
|
||||
#define PRIVATE_SHIFTED_FIT_TEST(Template, Number, Type, Value) BOOST_CHECK_EQUAL( Template < (ULONG_MAX >> Number) > :: Type ( Value ) , Value )
|
||||
#define PRIVATE_SHIFTED_FIT_TEST(Template, Number, Type, Value) BOOST_CHECK( Template < (ULONG_MAX >> Number) > :: Type ( Value ) == Value )
|
||||
|
||||
#define PRIVATE_SHIFTED_FIT_TESTS(Template, Type, ValType, InitVal) do { ValType v = InitVal ; \
|
||||
PRIVATE_SHIFTED_FIT_TEST(Template, 0, Type, v); v >>= 1; PRIVATE_SHIFTED_FIT_TEST(Template, 1, Type, v); v >>= 1; \
|
||||
@ -207,7 +206,7 @@ namespace boost
|
||||
PRIVATE_SHIFTED_FIT_TEST(Template, 28, Type, v); v >>= 1; PRIVATE_SHIFTED_FIT_TEST(Template, 29, Type, v); v >>= 1; \
|
||||
PRIVATE_SHIFTED_FIT_TEST(Template, 30, Type, v); v >>= 1; PRIVATE_SHIFTED_FIT_TEST(Template, 31, Type, v); } while ( false )
|
||||
|
||||
#define PRIVATE_POS_SHIFTED_FIT_TEST(Template, Number, Type, Value) BOOST_CHECK_EQUAL( Template < (LONG_MAX >> Number) > :: Type ( Value ) , Value )
|
||||
#define PRIVATE_POS_SHIFTED_FIT_TEST(Template, Number, Type, Value) BOOST_CHECK( Template < (LONG_MAX >> Number) > :: Type ( Value ) == Value )
|
||||
|
||||
#define PRIVATE_POS_FIT_TESTS(Template, Type, ValType, InitVal) do { ValType v = InitVal ; \
|
||||
PRIVATE_POS_SHIFTED_FIT_TEST(Template, 0, Type, v); v >>= 1; PRIVATE_POS_SHIFTED_FIT_TEST(Template, 1, Type, v); v >>= 1; \
|
||||
@ -227,7 +226,7 @@ namespace boost
|
||||
PRIVATE_POS_SHIFTED_FIT_TEST(Template, 28, Type, v); v >>= 1; PRIVATE_POS_SHIFTED_FIT_TEST(Template, 29, Type, v); v >>= 1; \
|
||||
PRIVATE_POS_SHIFTED_FIT_TEST(Template, 30, Type, v); v >>= 1; PRIVATE_POS_SHIFTED_FIT_TEST(Template, 31, Type, v); } while ( false )
|
||||
|
||||
#define PRIVATE_NEG_SHIFTED_FIT_TEST(Template, Number, Type, Value) BOOST_CHECK_EQUAL( Template < (LONG_MIN >> Number) > :: Type ( Value ) , Value )
|
||||
#define PRIVATE_NEG_SHIFTED_FIT_TEST(Template, Number, Type, Value) BOOST_CHECK( Template < (LONG_MIN >> Number) > :: Type ( Value ) == Value )
|
||||
|
||||
#define PRIVATE_NEG_FIT_TESTS(Template, Type, ValType, InitVal) do { ValType v = InitVal ; \
|
||||
PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 0, Type, v); v >>= 1; PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 1, Type, v); v >>= 1; \
|
||||
@ -248,56 +247,17 @@ namespace boost
|
||||
PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 30, Type, v); v >>= 1; PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 31, Type, v); } while ( false )
|
||||
|
||||
|
||||
// Check if given types can support given size parameters
|
||||
BOOST_AUTO_TEST_SUITE( show_type_tests )
|
||||
|
||||
// Check size parameters given by bit length
|
||||
BOOST_AUTO_TEST_CASE( show_bit_length_type_test )
|
||||
{
|
||||
SHOW_TYPES( boost::int_t, least );
|
||||
SHOW_TYPES( boost::int_t, fast );
|
||||
SHOW_TYPES( boost::uint_t, least );
|
||||
SHOW_TYPES( boost::uint_t, fast );
|
||||
}
|
||||
|
||||
// Check size parameters given by maximum or minimum (i.e. extreme) value
|
||||
BOOST_AUTO_TEST_CASE( show_extreme_type_test )
|
||||
{
|
||||
SHOW_POS_SHIFTED_TYPES( boost::int_max_value_t, least );
|
||||
SHOW_POS_SHIFTED_TYPES( boost::int_max_value_t, fast );
|
||||
|
||||
SHOW_NEG_SHIFTED_TYPES( boost::int_min_value_t, least );
|
||||
SHOW_NEG_SHIFTED_TYPES( boost::int_min_value_t, fast );
|
||||
|
||||
SHOW_SHIFTED_TYPES( boost::uint_value_t, least );
|
||||
SHOW_SHIFTED_TYPES( boost::uint_value_t, fast );
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
// Check if given constants can fit in given types
|
||||
BOOST_AUTO_TEST_SUITE( fit_type_tests )
|
||||
|
||||
// Check against large initial value
|
||||
BOOST_AUTO_TEST_CASE( show_bit_length_type_test )
|
||||
// Test program
|
||||
int
|
||||
test_main
|
||||
(
|
||||
int,
|
||||
char*[]
|
||||
)
|
||||
{
|
||||
#ifndef BOOST_NO_USING_TEMPLATE
|
||||
using boost::int_t;
|
||||
using boost::uint_t;
|
||||
#else
|
||||
using namespace boost;
|
||||
#endif
|
||||
|
||||
PRIVATE_FIT_TESTS( int_t, least, long, LONG_MAX );
|
||||
PRIVATE_FIT_TESTS( int_t, fast, long, LONG_MAX );
|
||||
PRIVATE_FIT_TESTS( uint_t, least, unsigned long, ULONG_MAX );
|
||||
PRIVATE_FIT_TESTS( uint_t, fast, unsigned long, ULONG_MAX );
|
||||
}
|
||||
|
||||
// Check against (absolutely) large initial value
|
||||
BOOST_AUTO_TEST_CASE( show_extreme_type_test )
|
||||
{
|
||||
#ifndef BOOST_NO_USING_TEMPLATE
|
||||
using boost::int_max_value_t;
|
||||
using boost::int_min_value_t;
|
||||
using boost::uint_value_t;
|
||||
@ -305,14 +265,27 @@ BOOST_AUTO_TEST_CASE( show_extreme_type_test )
|
||||
using namespace boost;
|
||||
#endif
|
||||
|
||||
SHOW_TYPES( int_t, least );
|
||||
SHOW_TYPES( int_t, fast );
|
||||
SHOW_TYPES( uint_t, least );
|
||||
SHOW_TYPES( uint_t, fast );
|
||||
SHOW_POS_SHIFTED_TYPES( int_max_value_t, least );
|
||||
SHOW_POS_SHIFTED_TYPES( int_max_value_t, fast );
|
||||
SHOW_NEG_SHIFTED_TYPES( int_min_value_t, least );
|
||||
SHOW_NEG_SHIFTED_TYPES( int_min_value_t, fast );
|
||||
SHOW_SHIFTED_TYPES( uint_value_t, least );
|
||||
SHOW_SHIFTED_TYPES( uint_value_t, fast );
|
||||
|
||||
PRIVATE_FIT_TESTS( int_t, least, long, LONG_MAX );
|
||||
PRIVATE_FIT_TESTS( int_t, fast, long, LONG_MAX );
|
||||
PRIVATE_FIT_TESTS( uint_t, least, unsigned long, ULONG_MAX );
|
||||
PRIVATE_FIT_TESTS( uint_t, fast, unsigned long, ULONG_MAX );
|
||||
PRIVATE_POS_FIT_TESTS( int_max_value_t, least, long, LONG_MAX );
|
||||
PRIVATE_POS_FIT_TESTS( int_max_value_t, fast, long, LONG_MAX );
|
||||
|
||||
PRIVATE_NEG_FIT_TESTS( int_min_value_t, least, long, LONG_MIN );
|
||||
PRIVATE_NEG_FIT_TESTS( int_min_value_t, fast, long, LONG_MIN );
|
||||
|
||||
PRIVATE_SHIFTED_FIT_TESTS( uint_value_t, least, unsigned long, ULONG_MAX );
|
||||
PRIVATE_SHIFTED_FIT_TESTS( uint_value_t, fast, unsigned long, ULONG_MAX );
|
||||
|
||||
return boost::exit_success;
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
@ -77,7 +77,7 @@ Test Program</h2>
|
||||
|
||||
<p>
|
||||
|
||||
The program <code><a href="test/integer_traits_test.cpp">integer_traits_test.cpp</a></code>
|
||||
The program <code><a href="integer_traits_test.cpp">integer_traits_test.cpp</a></code>
|
||||
exercises the <code>integer_traits</code> class.
|
||||
|
||||
<h2>Acknowledgements</h2>
|
||||
@ -85,10 +85,5 @@ exercises the <code>integer_traits</code> class.
|
||||
Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers discussed the integer
|
||||
traits idea on the boost mailing list in August 1999.
|
||||
<hr>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->06 November 2007<!--webbot bot="Timestamp" endspan i-checksum="40336" --></p>
|
||||
<p><EFBFBD> Copyright Beman Dawes 2000</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>
|
||||
|
||||
<a href="../../people/jens_maurer.htm">
|
||||
Jens Maurer</a>, 2000-02-20
|
@ -1,19 +0,0 @@
|
||||
#~ Copyright Rene Rivera 2008
|
||||
#~ 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)
|
||||
|
||||
import testing ;
|
||||
|
||||
test-suite integer
|
||||
: [ run cstdint_test.cpp ]
|
||||
[ run integer_test.cpp
|
||||
/boost/test//boost_unit_test_framework ]
|
||||
[ run integer_traits_test.cpp
|
||||
/boost/test//boost_test_exec_monitor/<link>static ]
|
||||
[ run integer_mask_test.cpp
|
||||
/boost/test//boost_test_exec_monitor/<link>static ]
|
||||
[ run static_log2_test.cpp
|
||||
/boost/test//boost_test_exec_monitor/<link>static ]
|
||||
[ run static_min_max_test.cpp
|
||||
/boost/test//boost_test_exec_monitor/<link>static ]
|
||||
;
|
Reference in New Issue
Block a user