diff --git a/doc/integer_mask.html b/doc/integer_mask.html
new file mode 100644
index 0000000..51ae8c9
--- /dev/null
+++ b/doc/integer_mask.html
@@ -0,0 +1,211 @@
+
+
+
+Integer Bit Mask Templates
+
+
+
+
Integer Bit Mask Templates
+
+The class templates in <boost/integer/integer_mask.hpp> provide bit masks for a certain bit position or a contiguous-bit pack of a certain size. The types of the masking constants come from the integer type selection templates header.
+
+
+
+
+
+
+
+
+#include <cstddef> // for std::size_t
+
+namespace boost
+{
+
+template < std::size_t Bit >
+struct high_bit_mask_t
+{
+ typedef implementation_supplied least;
+ typedef implementation_supplied fast;
+
+ static const least high_bit = implementation_defined;
+ static const fast high_bit_fast = implementation_defined;
+
+ static const std::size_t bit_position = Bit;
+
+};
+
+template < std::size_t Bits >
+struct low_bits_mask_t
+{
+ typedef implementation_supplied least;
+ typedef implementation_supplied fast;
+
+ static const least sig_bits = implementation_defined;
+ static const fast sig_bits_fast = implementation_defined;
+
+ static const std::size_t bit_count = Bits;
+
+};
+
+// Specializations for low_bits_mask_t exist for certain bit counts.
+
+} // namespace boost
+
+
+
+
+The boost::high_bit_mask_t
class template provides
+constants for bit masks representing the bit at a certain position. The
+masks are equivalent to the value 2Bit
, where
+Bit
is the template parameter. The bit position must be a
+nonnegative number from zero to Max, where Max is one
+less than the number of bits supported by the largest unsigned built-in
+integral type. The following table describes the members of an
+instantiation of high_bit_mask_t
.
+
+
+ Members of the boost::high_bit_mask_t
Class
+ Template
+
+ Member |
+ Meaning |
+
+
+ least |
+ The smallest unsigned built-in type that supports the given
+ bit position. |
+
+
+ fast |
+ The quick-to-manipulate analog of least . |
+
+
+ high_bit |
+ A least constant of the desired bit-masking
+ value. |
+
+
+ high_bit_fast |
+ A fast analog of high_bit . |
+
+
+ bit_position |
+ The value of the template parameter, in case its needed from
+ a renamed instantiation of the class template. |
+
+
+
+
+
+The boost::low_bits_mask_t
class template provides
+constants for bit masks representing the lowest bits of a certain
+amount. The masks are equivalent to the value
+(2Bits
- 1), where Bits
is the
+template parameter. The bit amount must be a nonnegative number from
+zero to Max, 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
+low_bits_mask_t
.
+
+
+ Members of the boost::low_bits_mask_t
Class
+ Template
+
+ Member |
+ Meaning |
+
+
+ least |
+ The smallest unsigned built-in type that supports the given
+ bit count. |
+
+
+ fast |
+ The quick-to-manipulate analog of least . |
+
+
+ sig_bits |
+ A least constant of the desired bit-masking
+ value. |
+
+
+ sig_bits_fast |
+ A fast analog of sig_bits . |
+
+
+ bit_count |
+ The value of the template parameter, in case its needed from
+ a renamed instantiation of the class template. |
+
+
+
+Implementation Note
+When Bits
is the exact size of a built-in unsigned type,
+the implementation has to change to prevent undefined behavior.
+Therefore, there are specializations of low_bits_mask_t
at
+those bit counts.
+
+
+
+
+#include <boost/integer/integer_mask.hpp>
+
+//...
+
+int main()
+{
+ typedef boost::high_bit_mask_t<29> mask1_type;
+ typedef boost::low_bits_mask_t<15> mask2_type;
+
+ mask1_type::least my_var1;
+ mask2_type::fast my_var2;
+ //...
+
+ my_var1 |= mask1_type::high_bit;
+ my_var2 &= mask2_type::sig_bits_fast;
+
+ //...
+}
+
+
+
+
+The program integer_mask_test.cpp
+is a simplistic demonstration of the results from instantiating various
+examples of the bit mask class templates.
+
+
+
+The class templates in this header are an extension of the integer type selection class templates. The new
+class templates provide the same sized types, but also convienent masks
+to use when extracting the highest or all the significant bits when the
+containing built-in type contains more bits. This prevents
+contaimination of values by the higher, unused bits.
+
+
+
+The author of the Boost bit mask class templates is Daryle Walker.
+
+
+
+Revised September 23, 2001
+
+© Copyright Daryle Walker 2001. Permission to copy, use,
+modify, sell and distribute this document is granted provided this
+copyright notice appears in all copies. This document is provided
+"as is" without express or implied warranty, and with no claim
+as to its suitability for any purpose.
+
+
diff --git a/doc/static_log2.html b/doc/static_log2.html
new file mode 100644
index 0000000..d3daab2
--- /dev/null
+++ b/doc/static_log2.html
@@ -0,0 +1,122 @@
+
+
+
+Binary Logarithm Template
+
+
+
+
Binary Logarithm Template
+
+The class template in <boost/integer/static_log2.hpp> determines the position of the highest bit in a given value. This facility is useful for solving generic programming problems.
+
+
+
+
+
+
+
+
+namespace boost
+{
+
+template < unsigned long Value >
+struct static_log2
+{
+ static const int value = implementation_defined;
+};
+
+template < >
+struct static_log2< 0ul >
+{
+ // The logarithm of zero is undefined.
+};
+
+} // namespace boost
+
+
+
+
+The boost::static_log2
class template takes one template
+parameter, a value of type unsigned long
. The template
+only defines one member, value
, that returns the truncated
+base-two logarithm of the template parameter.
+
+Since the logarithm of zero, for any base, is undefined, there is a
+specialization of static_log2
for a template parameter
+of zero. This specialization has no members, so an attempt to use
+the base-two logarithm of zero results in a compile-time error.
+
+
+
+
+#include <boost/integer/static_log2.hpp>
+
+template < unsigned long 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 program static_log2_test.cpp
+is a simplistic demonstration of the results from instantiating various
+examples of the binary logarithm class template.
+
+
+
+The base-two (binary) logarithm, abbreviated lb, function
+is occasionally used to give order-estimates of computer algorithms.
+The truncated logarithm 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 (i.e.
+at compile-time) available.
+
+
+
+The author of the Boost binary logarithm class template is Daryle Walker.
+
+
+
+Revised October 1, 2001
+
+© Copyright Daryle Walker 2001. Permission to copy, use,
+modify, sell and distribute this document is granted provided this
+copyright notice appears in all copies. This document is provided
+"as is" without express or implied warranty, and with no claim
+as to its suitability for any purpose.
+
+
diff --git a/doc/static_min_max.html b/doc/static_min_max.html
new file mode 100644
index 0000000..6f27b97
--- /dev/null
+++ b/doc/static_min_max.html
@@ -0,0 +1,121 @@
+
+
+
+Compile-Time Extrema Templates
+
+
+
+
Compile-Time Extrema
+Templates
+
+The class templates in <boost/integer/static_min_max.hpp>
+provide a compile-time evaluation of the minimum or maximum of
+two integers. These facilities are useful for generic programming problems.
+
+
+
+
+
+
+
+
+namespace boost
+{
+
+template < long Value1, long Value2 >
+ struct static_signed_min;
+
+template < long Value1, long Value2 >
+ struct static_signed_max;
+
+template < unsigned long Value1, unsigned long Value2 >
+ struct static_unsigned_min;
+
+template < unsigned long Value1, unsigned long Value2 >
+ struct static_unsigned_max;
+
+}
+
+
+
+
+The four class templates provide the combinations for finding the
+minimum or maximum of two signed or unsigned
+(long
) parameters, Value1 and Value2,
+at compile-time. Each template has a single static data member,
+value
, which is set to the respective minimum or maximum
+of the template's parameters.
+
+
+
+
+#include <boost/integer/static_min_max.hpp>
+
+template < unsigned long AddendSize1, unsigned long AddendSize2 >
+class adder
+{
+public:
+ static unsigned long const addend1_size = AddendSize1;
+ static unsigned long const addend2_size = AddendSize2;
+ static unsigned long const sum_size = boost::static_unsigned_max<AddendSize1, AddendSize2>::value + 1;
+
+ typedef int addend1_type[ addend1_size ];
+ typedef int addend2_type[ addend2_size ];
+ typedef int sum_type[ sum_size ];
+
+ void operator ()( addend1_type const &a1, addend2_type const &a2, sum_type &s ) const;
+};
+
+//...
+
+int main()
+{
+ int const a1[] = { 0, 4, 3 }; // 340
+ int const a2[] = { 9, 8 }; // 89
+ int s[ 4 ];
+ adder<3,2> obj;
+
+ obj( a1, a2, s ); // 's' should be 429 or { 9, 2, 4, 0 }
+ //...
+}
+
+
+
+
+The program static_min_max_test.cpp is a
+simplistic demonstration of various comparisons using the compile-time
+extrema class templates.
+
+
+
+Sometimes the minimum or maximum of several values needs to be found
+for later compile-time processing, e.g. for a bound for another
+class template.
+
+
+
+The author of the Boost compile-time extrema class templates is Daryle Walker.
+
+
+
+Revised October 12, 2001
+
+© Copyright Daryle Walker 2001. Permission to copy, use,
+modify, sell and distribute this document is granted provided this
+copyright notice appears in all copies. This document is provided
+"as is" without express or implied warranty, and with no claim
+as to its suitability for any purpose.
+
+
diff --git a/test/integer_mask_test.cpp b/test/integer_mask_test.cpp
new file mode 100644
index 0000000..4cf7a4e
--- /dev/null
+++ b/test/integer_mask_test.cpp
@@ -0,0 +1,112 @@
+// boost integer_mask.hpp test program -------------------------------------//
+
+// (C) Copyright Daryle Walker 2001. Permission to copy, use, modify, sell
+// and distribute this software is granted provided this copyright
+// notice appears in all copies. This software is provided "as is" without
+// express or implied warranty, and with no claim as to its suitability for
+// any purpose.
+
+// See http://www.boost.org for most recent version including documentation.
+
+// Revision History
+// 23 Sep 2001 Initial version (Daryle Walker)
+
+#define BOOST_INCLUDE_MAIN
+#include // for main
+
+#include // for boost::exit_success
+#include // for boost::high_bit_mask_t, etc.
+
+#include // for std::cout (std::endl indirectly)
+
+
+#define PRIVATE_HIGH_BIT_SLOW_TEST(v) BOOST_TEST( ::boost::high_bit_mask_t< \
+ (v) >::high_bit == (1ul << (v)) );
+#define PRIVATE_HIGH_BIT_FAST_TEST(v) BOOST_TEST( ::boost::high_bit_mask_t< \
+ (v) >::high_bit_fast == (1ul << (v)) );
+#define PRIVATE_HIGH_BIT_TEST(v) do { PRIVATE_HIGH_BIT_SLOW_TEST(v); \
+ PRIVATE_HIGH_BIT_FAST_TEST(v); } while (false)
+
+#define PRIVATE_LOW_BITS_SLOW_TEST(v) BOOST_TEST( ::boost::low_bits_mask_t< \
+ (v) >::sig_bits == ((1ul << (v)) - 1) );
+#define PRIVATE_LOW_BITS_FAST_TEST(v) BOOST_TEST( ::boost::low_bits_mask_t< \
+ (v) >::sig_bits_fast == ((1ul << (v)) - 1) );
+#define PRIVATE_LOW_BITS_TEST(v) do { PRIVATE_LOW_BITS_SLOW_TEST(v); \
+ PRIVATE_LOW_BITS_FAST_TEST(v); } while (false)
+
+
+int test_main( int, char*[] )
+{
+ using std::cout;
+ using std::endl;
+
+ cout << "Doing high_bit_mask_t tests." << endl;
+ PRIVATE_HIGH_BIT_TEST( 31 );
+ PRIVATE_HIGH_BIT_TEST( 30 );
+ PRIVATE_HIGH_BIT_TEST( 29 );
+ PRIVATE_HIGH_BIT_TEST( 28 );
+ PRIVATE_HIGH_BIT_TEST( 27 );
+ PRIVATE_HIGH_BIT_TEST( 26 );
+ PRIVATE_HIGH_BIT_TEST( 25 );
+ PRIVATE_HIGH_BIT_TEST( 24 );
+ PRIVATE_HIGH_BIT_TEST( 23 );
+ PRIVATE_HIGH_BIT_TEST( 22 );
+ PRIVATE_HIGH_BIT_TEST( 21 );
+ PRIVATE_HIGH_BIT_TEST( 20 );
+ PRIVATE_HIGH_BIT_TEST( 19 );
+ PRIVATE_HIGH_BIT_TEST( 18 );
+ PRIVATE_HIGH_BIT_TEST( 17 );
+ PRIVATE_HIGH_BIT_TEST( 16 );
+ PRIVATE_HIGH_BIT_TEST( 15 );
+ PRIVATE_HIGH_BIT_TEST( 14 );
+ PRIVATE_HIGH_BIT_TEST( 13 );
+ PRIVATE_HIGH_BIT_TEST( 12 );
+ PRIVATE_HIGH_BIT_TEST( 11 );
+ PRIVATE_HIGH_BIT_TEST( 10 );
+ PRIVATE_HIGH_BIT_TEST( 9 );
+ PRIVATE_HIGH_BIT_TEST( 8 );
+ PRIVATE_HIGH_BIT_TEST( 7 );
+ PRIVATE_HIGH_BIT_TEST( 6 );
+ PRIVATE_HIGH_BIT_TEST( 5 );
+ PRIVATE_HIGH_BIT_TEST( 4 );
+ PRIVATE_HIGH_BIT_TEST( 3 );
+ PRIVATE_HIGH_BIT_TEST( 2 );
+ PRIVATE_HIGH_BIT_TEST( 1 );
+ PRIVATE_HIGH_BIT_TEST( 0 );
+
+ cout << "Doing low_bits_mask_t tests." << endl;
+ PRIVATE_LOW_BITS_TEST( 32 ); // Undefined behavior? Whoops!
+ PRIVATE_LOW_BITS_TEST( 31 );
+ PRIVATE_LOW_BITS_TEST( 30 );
+ PRIVATE_LOW_BITS_TEST( 29 );
+ PRIVATE_LOW_BITS_TEST( 28 );
+ PRIVATE_LOW_BITS_TEST( 27 );
+ PRIVATE_LOW_BITS_TEST( 26 );
+ PRIVATE_LOW_BITS_TEST( 25 );
+ PRIVATE_LOW_BITS_TEST( 24 );
+ PRIVATE_LOW_BITS_TEST( 23 );
+ PRIVATE_LOW_BITS_TEST( 22 );
+ PRIVATE_LOW_BITS_TEST( 21 );
+ PRIVATE_LOW_BITS_TEST( 20 );
+ PRIVATE_LOW_BITS_TEST( 19 );
+ PRIVATE_LOW_BITS_TEST( 18 );
+ PRIVATE_LOW_BITS_TEST( 17 );
+ PRIVATE_LOW_BITS_TEST( 16 );
+ PRIVATE_LOW_BITS_TEST( 15 );
+ PRIVATE_LOW_BITS_TEST( 14 );
+ PRIVATE_LOW_BITS_TEST( 13 );
+ PRIVATE_LOW_BITS_TEST( 12 );
+ PRIVATE_LOW_BITS_TEST( 11 );
+ PRIVATE_LOW_BITS_TEST( 10 );
+ PRIVATE_LOW_BITS_TEST( 9 );
+ PRIVATE_LOW_BITS_TEST( 8 );
+ PRIVATE_LOW_BITS_TEST( 7 );
+ PRIVATE_LOW_BITS_TEST( 6 );
+ PRIVATE_LOW_BITS_TEST( 5 );
+ PRIVATE_LOW_BITS_TEST( 4 );
+ PRIVATE_LOW_BITS_TEST( 3 );
+ PRIVATE_LOW_BITS_TEST( 2 );
+ PRIVATE_LOW_BITS_TEST( 1 );
+
+ return boost::exit_success;
+}
diff --git a/test/static_log2_test.cpp b/test/static_log2_test.cpp
new file mode 100644
index 0000000..abc109b
--- /dev/null
+++ b/test/static_log2_test.cpp
@@ -0,0 +1,151 @@
+// Boost static_log2.hpp test program --------------------------------------//
+
+// (C) Copyright Daryle Walker 2001. Permission to copy, use, modify, sell
+// and distribute this software is granted provided this copyright
+// notice appears in all copies. This software is provided "as is" without
+// express or implied warranty, and with no claim as to its suitability for
+// any purpose.
+
+// See http://www.boost.org for most recent version including documentation.
+
+// Revision History
+// 01 Oct 2001 Initial version (Daryle Walker)
+
+#define BOOST_INCLUDE_MAIN
+#include // for main
+
+#include // for boost::exit_success
+#include // for boost::static_log2
+
+#include // for std::cout (std::endl indirectly)
+
+
+// Macros to compact code
+#define PRIVATE_LB_TEST( v, e ) BOOST_TEST( ::boost::static_log2::value == e )
+
+#define PRIVATE_PRINT_LB( v ) ::std::cout << "boost::static_log2<" << (v) \
+ << "> = " << ::boost::static_log2< (v) >::value << '.' << ::std::endl
+
+// Control to check for a compile-time error
+#ifndef CONTROL_LB_0_TEST
+#define PRIVATE_LB_0_TEST
+#else
+#define PRIVATE_LB_0_TEST PRIVATE_PRINT_LB( 0 )
+#endif
+
+
+// Main testing function
+int
+test_main
+(
+ int , // "argc" is unused
+ char * [] // "argv" is unused
+)
+{
+ std::cout << "Doing tests on static_log2." << std::endl;
+
+ PRIVATE_LB_0_TEST;
+
+ PRIVATE_LB_TEST( 1, 0 );
+
+ PRIVATE_LB_TEST( 2, 1 );
+ PRIVATE_LB_TEST( 3, 1 );
+
+ PRIVATE_LB_TEST( 4, 2 );
+ PRIVATE_LB_TEST( 5, 2 );
+ PRIVATE_LB_TEST( 6, 2 );
+ PRIVATE_LB_TEST( 7, 2 );
+
+ PRIVATE_LB_TEST( 8, 3 );
+ PRIVATE_LB_TEST( 9, 3 );
+ PRIVATE_LB_TEST( 10, 3 );
+ PRIVATE_LB_TEST( 11, 3 );
+ PRIVATE_LB_TEST( 12, 3 );
+ PRIVATE_LB_TEST( 13, 3 );
+ PRIVATE_LB_TEST( 14, 3 );
+ PRIVATE_LB_TEST( 15, 3 );
+
+ PRIVATE_LB_TEST( 16, 4 );
+ PRIVATE_LB_TEST( 17, 4 );
+ PRIVATE_LB_TEST( 18, 4 );
+ PRIVATE_LB_TEST( 19, 4 );
+ PRIVATE_LB_TEST( 20, 4 );
+ PRIVATE_LB_TEST( 21, 4 );
+ PRIVATE_LB_TEST( 22, 4 );
+ PRIVATE_LB_TEST( 23, 4 );
+ PRIVATE_LB_TEST( 24, 4 );
+ PRIVATE_LB_TEST( 25, 4 );
+ PRIVATE_LB_TEST( 26, 4 );
+ PRIVATE_LB_TEST( 27, 4 );
+ PRIVATE_LB_TEST( 28, 4 );
+ PRIVATE_LB_TEST( 29, 4 );
+ PRIVATE_LB_TEST( 30, 4 );
+ PRIVATE_LB_TEST( 31, 4 );
+
+ PRIVATE_LB_TEST( 32, 5 );
+ PRIVATE_LB_TEST( 33, 5 );
+ PRIVATE_LB_TEST( 34, 5 );
+ PRIVATE_LB_TEST( 35, 5 );
+ PRIVATE_LB_TEST( 36, 5 );
+ PRIVATE_LB_TEST( 37, 5 );
+ PRIVATE_LB_TEST( 38, 5 );
+ PRIVATE_LB_TEST( 39, 5 );
+ PRIVATE_LB_TEST( 40, 5 );
+
+ PRIVATE_LB_TEST( 63, 5 );
+
+ PRIVATE_LB_TEST( 64, 6 );
+ PRIVATE_LB_TEST( 65, 6 );
+
+ PRIVATE_LB_TEST( 127, 6 );
+
+ PRIVATE_LB_TEST( 128, 7 );
+ PRIVATE_LB_TEST( 129, 7 );
+
+ PRIVATE_LB_TEST( 255, 7 );
+
+ PRIVATE_LB_TEST( 256, 8 );
+ PRIVATE_LB_TEST( 257, 8 );
+
+ PRIVATE_LB_TEST( 511, 8 );
+
+ PRIVATE_LB_TEST( 512, 9 );
+ PRIVATE_LB_TEST( 513, 9 );
+
+ PRIVATE_LB_TEST( 1023, 9 );
+
+ PRIVATE_LB_TEST( 1024, 10 );
+ PRIVATE_LB_TEST( 1025, 10 );
+
+ PRIVATE_LB_TEST( 2047, 10 );
+
+ PRIVATE_LB_TEST( 2048, 11 );
+ PRIVATE_LB_TEST( 2049, 11 );
+
+ PRIVATE_LB_TEST( 4095, 11 );
+
+ PRIVATE_LB_TEST( 4096, 12 );
+ PRIVATE_LB_TEST( 4097, 12 );
+
+ PRIVATE_LB_TEST( 8191, 12 );
+
+ PRIVATE_LB_TEST( 8192, 13 );
+ PRIVATE_LB_TEST( 8193, 13 );
+
+ PRIVATE_LB_TEST( 16383, 13 );
+
+ PRIVATE_LB_TEST( 16384, 14 );
+ PRIVATE_LB_TEST( 16385, 14 );
+
+ PRIVATE_LB_TEST( 32767, 14 );
+
+ PRIVATE_LB_TEST( 32768, 15 );
+ PRIVATE_LB_TEST( 32769, 15 );
+
+ PRIVATE_LB_TEST( 65535, 15 );
+
+ PRIVATE_LB_TEST( 65536, 16 );
+ PRIVATE_LB_TEST( 65537, 16 );
+
+ return boost::exit_success;
+}
diff --git a/test/static_min_max_test.cpp b/test/static_min_max_test.cpp
new file mode 100644
index 0000000..7da322c
--- /dev/null
+++ b/test/static_min_max_test.cpp
@@ -0,0 +1,94 @@
+// Boost static_min_max.hpp test program -----------------------------------//
+
+// (C) Copyright Daryle Walker 2001. Permission to copy, use, modify, sell
+// and distribute this software is granted provided this copyright
+// notice appears in all copies. This software is provided "as is" without
+// express or implied warranty, and with no claim as to its suitability for
+// any purpose.
+
+// See http://www.boost.org for most recent version including documentation.
+
+// Revision History
+// 23 Sep 2001 Initial version (Daryle Walker)
+
+#define BOOST_INCLUDE_MAIN
+#include // for main, BOOST_TEST
+
+#include // for boost::exit_success
+#include // for boost::static_signed_min, etc.
+
+#include // for std::cout (std::endl indirectly)
+
+
+// Main testing function
+int
+test_main
+(
+ int , // "argc" is unused
+ char * [] // "argv" is unused
+)
+{
+ using std::cout;
+ using std::endl;
+ using boost::static_signed_min;
+ using boost::static_signed_max;
+ using boost::static_unsigned_min;
+ using boost::static_unsigned_max;
+
+ // Two positives
+ cout << "Doing tests with two positive values." << endl;
+
+ BOOST_TEST( (static_signed_min< 9, 14>::value) == 9 );
+ BOOST_TEST( (static_signed_max< 9, 14>::value) == 14 );
+ BOOST_TEST( (static_signed_min<14, 9>::value) == 9 );
+ BOOST_TEST( (static_signed_max<14, 9>::value) == 14 );
+
+ BOOST_TEST( (static_unsigned_min< 9, 14>::value) == 9 );
+ BOOST_TEST( (static_unsigned_max< 9, 14>::value) == 14 );
+ BOOST_TEST( (static_unsigned_min<14, 9>::value) == 9 );
+ BOOST_TEST( (static_unsigned_max<14, 9>::value) == 14 );
+
+ // Two negatives
+ cout << "Doing tests with two negative values." << endl;
+
+ BOOST_TEST( (static_signed_min< -8, -101>::value) == -101 );
+ BOOST_TEST( (static_signed_max< -8, -101>::value) == -8 );
+ BOOST_TEST( (static_signed_min<-101, -8>::value) == -101 );
+ BOOST_TEST( (static_signed_max<-101, -8>::value) == -8 );
+
+ // With zero
+ cout << "Doing tests with zero and a positive or negative value." << endl;
+
+ BOOST_TEST( (static_signed_min< 0, 14>::value) == 0 );
+ BOOST_TEST( (static_signed_max< 0, 14>::value) == 14 );
+ BOOST_TEST( (static_signed_min<14, 0>::value) == 0 );
+ BOOST_TEST( (static_signed_max<14, 0>::value) == 14 );
+
+ BOOST_TEST( (static_unsigned_min< 0, 14>::value) == 0 );
+ BOOST_TEST( (static_unsigned_max< 0, 14>::value) == 14 );
+ BOOST_TEST( (static_unsigned_min<14, 0>::value) == 0 );
+ BOOST_TEST( (static_unsigned_max<14, 0>::value) == 14 );
+
+ BOOST_TEST( (static_signed_min< 0, -101>::value) == -101 );
+ BOOST_TEST( (static_signed_max< 0, -101>::value) == 0 );
+ BOOST_TEST( (static_signed_min<-101, 0>::value) == -101 );
+ BOOST_TEST( (static_signed_max<-101, 0>::value) == 0 );
+
+ // With identical
+ cout << "Doing tests with two identical values." << endl;
+
+ BOOST_TEST( (static_signed_min<0, 0>::value) == 0 );
+ BOOST_TEST( (static_signed_max<0, 0>::value) == 0 );
+ BOOST_TEST( (static_unsigned_min<0, 0>::value) == 0 );
+ BOOST_TEST( (static_unsigned_max<0, 0>::value) == 0 );
+
+ BOOST_TEST( (static_signed_min<14, 14>::value) == 14 );
+ BOOST_TEST( (static_signed_max<14, 14>::value) == 14 );
+ BOOST_TEST( (static_unsigned_min<14, 14>::value) == 14 );
+ BOOST_TEST( (static_unsigned_max<14, 14>::value) == 14 );
+
+ BOOST_TEST( (static_signed_min< -101, -101>::value) == -101 );
+ BOOST_TEST( (static_signed_max< -101, -101>::value) == -101 );
+
+ return boost::exit_success;
+}