Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62363 - in sandbox/SOC/2010/bits_and_ints: boost/integer boost/integer/detail libs/integer/doc libs/integer/doc/html libs/integer/doc/html/boost_integer libs/integer/test
From: muriloufg_at_[hidden]
Date: 2010-05-31 19:20:19


Author: murilov
Date: 2010-05-31 19:20:17 EDT (Mon, 31 May 2010)
New Revision: 62363
URL: http://svn.boost.org/trac/boost/changeset/62363

Log:
Function bit_reversal, static_bit_reversal template and some utilities declared in integer/detail/utils.hpp done.
Added:
   sandbox/SOC/2010/bits_and_ints/boost/integer/detail/bit_reversal.hpp (contents, props changed)
   sandbox/SOC/2010/bits_and_ints/libs/integer/test/bit_reversal_test.cpp (contents, props changed)
Text files modified:
   sandbox/SOC/2010/bits_and_ints/boost/integer/bits_and_ints.hpp | 8 +
   sandbox/SOC/2010/bits_and_ints/boost/integer/detail/sign_extend.hpp | 20 +----
   sandbox/SOC/2010/bits_and_ints/libs/integer/doc/html/boost_integer/history.html | 4
   sandbox/SOC/2010/bits_and_ints/libs/integer/doc/html/boost_integer/log2.html | 6
   sandbox/SOC/2010/bits_and_ints/libs/integer/doc/html/boost_integer/minmax.html | 6
   sandbox/SOC/2010/bits_and_ints/libs/integer/doc/html/index.html | 3
   sandbox/SOC/2010/bits_and_ints/libs/integer/doc/integer.qbk | 124 ++++++++++++++++++++++++++++++++++++++++
   sandbox/SOC/2010/bits_and_ints/libs/integer/test/Jamfile.v2 | 1
   sandbox/SOC/2010/bits_and_ints/libs/integer/test/sign_extend_test.cpp | 4
   9 files changed, 148 insertions(+), 28 deletions(-)

Modified: sandbox/SOC/2010/bits_and_ints/boost/integer/bits_and_ints.hpp
==============================================================================
--- sandbox/SOC/2010/bits_and_ints/boost/integer/bits_and_ints.hpp (original)
+++ sandbox/SOC/2010/bits_and_ints/boost/integer/bits_and_ints.hpp 2010-05-31 19:20:17 EDT (Mon, 31 May 2010)
@@ -1,9 +1,9 @@
-// Boost integer/sign_extend.hpp header file ------------------------------//
+// Boost integer/bits_and_ints.hpp header file ------------------------------//
 
 // (C) Copyright Murilo Adriano Vasconcelos 2010.
 // 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)
+// http://www.boost.org/LICENSE_1_0.txt
 
 // See http://www.boost.org for updates, documentation, and revision history.
 
@@ -11,6 +11,10 @@
 #define BOOST_BITS_AND_INTS
 
 // sign_extends and static_sign_extends
+//#include "utils.hpp"
 #include "detail/sign_extend.hpp"
+#include "detail/static_sign_extend.hpp"
+#include "detail/bit_reversal.hpp"
+#include "detail/static_bit_reversal.hpp"
 
 #endif
\ No newline at end of file

Added: sandbox/SOC/2010/bits_and_ints/boost/integer/detail/bit_reversal.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/bits_and_ints/boost/integer/detail/bit_reversal.hpp 2010-05-31 19:20:17 EDT (Mon, 31 May 2010)
@@ -0,0 +1,72 @@
+// Boost integer/detail/bit_reversal.hpp header file ------------------------------//
+
+// (C) Copyright Murilo Adriano Vasconcelos 2010.
+// 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
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#ifndef BOOST_BIT_REVERSAL_INCLUDED
+#define BOOST_BIT_REVERSAL_INCLUDED
+
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits.hpp>
+
+namespace boost
+{
+
+/*
+ * Reverses the bits in data
+ * For example if binary representation of data is:
+ * 00000000000010001010101000001111
+ * bit_reversal(data) is:
+ * 11110000010101010000000000000000
+ */
+
+
+#ifndef BOOST_NO_INT64_T
+// 64-bit version
+template <typename T>
+inline typename enable_if_c<is_integral<T>::type::value && sizeof(T) == 8, T>::type
+bit_reversal(T data)
+{
+ // swap odd and even bits
+ data = ((data >> 1) & 0x5555555555555555) | ((data & 0x5555555555555555) << 1);
+ // swap consecutive pairs
+ data = ((data >> 2) & 0x3333333333333333) | ((data & 0x3333333333333333) << 2);
+ // swap nibbles
+ data = ((data >> 4) & 0x0F0F0F0F0F0F0F0F) | ((data & 0x0F0F0F0F0F0F0F0F) << 4);
+ // swap bytes
+ data = ((data >> 8) & 0x00FF00FF00FF00FF) | ((data & 0x00FF00FF00FF00FF) << 8);
+ // swap 2-byte long pairs
+ data = ((data >> 16) & 0x0000FFFF0000FFFF) | ((data & 0x0000FFFF0000FFFF) << 16);
+ // swap the halves
+ data = (data >> 32 | data << 32);
+
+ return data;
+}
+#endif
+
+// 32-bit version
+template <typename T>
+inline typename enable_if_c<is_integral<T>::type::value && sizeof(T) == 4, T>::type
+bit_reversal(T data)
+{
+ // swap odd and even bits
+ data = ((data >> 1) & 0x55555555) | ((data & 0x55555555) << 1);
+ // swap consecutive pairs
+ data = ((data >> 2) & 0x33333333) | ((data & 0x33333333) << 2);
+ // swap nibbles
+ data = ((data >> 4) & 0x0F0F0F0F) | ((data & 0x0F0F0F0F) << 4);
+ // swap bytes
+ data = ((data >> 8) & 0x00FF00FF) | ((data & 0x00FF00FF) << 8);
+ // swap 2-byte long pairs
+ data = (data >> 16) | (data << 16);
+
+ return data;
+}
+
+} // boost
+
+#endif
\ No newline at end of file

Modified: sandbox/SOC/2010/bits_and_ints/boost/integer/detail/sign_extend.hpp
==============================================================================
--- sandbox/SOC/2010/bits_and_ints/boost/integer/detail/sign_extend.hpp (original)
+++ sandbox/SOC/2010/bits_and_ints/boost/integer/detail/sign_extend.hpp 2010-05-31 19:20:17 EDT (Mon, 31 May 2010)
@@ -1,4 +1,4 @@
-// Boost integer/sign_extend.hpp header file ------------------------------//
+// Boost integer/detail/sign_extend.hpp header file ------------------------------//
 
 // (C) Copyright Murilo Adriano Vasconcelos 2010.
 // Distributed under the Boost Software License, Version 1.0. (See
@@ -7,10 +7,10 @@
 
 // See http://www.boost.org for updates, documentation, and revision history.
 
-#ifndef BOOST_SIGN_EXTEND
-#define BOOST_SIGN_EXTEND
+#ifndef BOOST_SIGN_EXTEND_INCLUDED
+#define BOOST_SIGN_EXTEND_INCLUDED
 
-#include <boost/cstdint.hpp> // for uintmax_t
+#include <boost/cstdint.hpp> // for intmax_t
 #include <boost/assert.hpp>
 
 namespace boost
@@ -26,17 +26,7 @@
         Raw const m = (Raw(1) << (b - 1));
         return (data ^ m) - m;
 }
-
-// Compile-time version of sign_extend
-template<typename IntegralType, Raw raw, unsigned B>
-struct static_sign_extend
-{
- typedef IntegralType T;
- BOOST_STATIC_CONSTANT(Raw,
- value = ((raw & ((T(1) << B) - 1)) ^ (T(1) << (B - 1))) - (T(1) << (B - 1)) );
-}; // boost::static_sign_extend
         
-
-}
+} // boost
 
 #endif
\ No newline at end of file

Modified: sandbox/SOC/2010/bits_and_ints/libs/integer/doc/html/boost_integer/history.html
==============================================================================
--- sandbox/SOC/2010/bits_and_ints/libs/integer/doc/html/boost_integer/history.html (original)
+++ sandbox/SOC/2010/bits_and_ints/libs/integer/doc/html/boost_integer/history.html 2010-05-31 19:20:17 EDT (Mon, 31 May 2010)
@@ -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="id36189038"></a>
+<a name="id36189132"></a>
       <a class="link" href="history.html#boost_integer.history.1_42_0">1.42.0</a>
     </h5>
 <div class="itemizedlist"><ul class="itemizedlist" type="disc">
@@ -55,7 +55,7 @@
       </li>
 </ul></div>
 <a name="boost_integer.history.1_32_0"></a><h5>
-<a name="id36189146"></a>
+<a name="id36189241"></a>
       <a class="link" href="history.html#boost_integer.history.1_32_0">1.32.0</a>
     </h5>
 <div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">

Modified: sandbox/SOC/2010/bits_and_ints/libs/integer/doc/html/boost_integer/log2.html
==============================================================================
--- sandbox/SOC/2010/bits_and_ints/libs/integer/doc/html/boost_integer/log2.html (original)
+++ sandbox/SOC/2010/bits_and_ints/libs/integer/doc/html/boost_integer/log2.html 2010-05-31 19:20:17 EDT (Mon, 31 May 2010)
@@ -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="mask.html" title="Integer Masks">
-<link rel="next" href="minmax.html" title="Compile time min/max calculation">
+<link rel="next" href="bits_and_ints.html" title="Bits and Ints">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 <table cellpadding="2" width="100%"><tr>
@@ -20,7 +20,7 @@
 </tr></table>
 <hr>
 <div class="spirit-nav">
-<a accesskey="p" href="mask.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="minmax.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+<a accesskey="p" href="mask.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="bits_and_ints.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
 </div>
 <div class="section" title="Compile Time log2 Calculation">
 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
@@ -145,7 +145,7 @@
 </tr></table>
 <hr>
 <div class="spirit-nav">
-<a accesskey="p" href="mask.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="minmax.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+<a accesskey="p" href="mask.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="bits_and_ints.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
 </div>
 </body>
 </html>

Modified: sandbox/SOC/2010/bits_and_ints/libs/integer/doc/html/boost_integer/minmax.html
==============================================================================
--- sandbox/SOC/2010/bits_and_ints/libs/integer/doc/html/boost_integer/minmax.html (original)
+++ sandbox/SOC/2010/bits_and_ints/libs/integer/doc/html/boost_integer/minmax.html 2010-05-31 19:20:17 EDT (Mon, 31 May 2010)
@@ -6,7 +6,7 @@
 <meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
 <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="bits_and_ints.html" title="Bits and Ints">
 <link rel="next" href="history.html" title="History">
 </head>
 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@@ -20,7 +20,7 @@
 </tr></table>
 <hr>
 <div class="spirit-nav">
-<a accesskey="p" href="log2.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="history.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+<a accesskey="p" href="bits_and_ints.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="history.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
 </div>
 <div class="section" title="Compile time min/max calculation">
 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
@@ -154,7 +154,7 @@
 </tr></table>
 <hr>
 <div class="spirit-nav">
-<a accesskey="p" href="log2.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="history.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
+<a accesskey="p" href="bits_and_ints.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="history.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
 </div>
 </body>
 </html>

Modified: sandbox/SOC/2010/bits_and_ints/libs/integer/doc/html/index.html
==============================================================================
--- sandbox/SOC/2010/bits_and_ints/libs/integer/doc/html/index.html (original)
+++ sandbox/SOC/2010/bits_and_ints/libs/integer/doc/html/index.html 2010-05-31 19:20:17 EDT (Mon, 31 May 2010)
@@ -57,6 +57,7 @@
 <dt><span class="section"> Integer Type Selection</span></dt>
 <dt><span class="section"> Integer Masks</span></dt>
 <dt><span class="section"> Compile Time log2 Calculation</span></dt>
+<dt><span class="section"> Bits and Ints</span></dt>
 <dt><span class="section"> Compile time min/max calculation</span></dt>
 <dt><span class="section"> History</span></dt>
 </dl>
@@ -237,7 +238,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: May 02, 2010 at 02:23:56 GMT</small></p></td>
+<td align="left"><p><small>Last revised: May 06, 2010 at 18:27:06 GMT</small></p></td>
 <td align="right"><div class="copyright-footer"></div></td>
 </tr></table>
 <hr>

Modified: sandbox/SOC/2010/bits_and_ints/libs/integer/doc/integer.qbk
==============================================================================
--- sandbox/SOC/2010/bits_and_ints/libs/integer/doc/integer.qbk (original)
+++ sandbox/SOC/2010/bits_and_ints/libs/integer/doc/integer.qbk 2010-05-31 19:20:17 EDT (Mon, 31 May 2010)
@@ -719,6 +719,130 @@
 [endsect]
 [endsect]
 
+[section:bits_and_ints Bits and Ints]
+Bla bla bla
+
+
+df
+f
+
+ds
+f
+asdf
+
+fsd
+f
+das
+d
+f
+a
+sf
+dsa
+fda
+f
+samefs
+daf
+asdffsa
+f
+AddendSize1f
+ads
+fsa
+f
+samefsfsa
+f
+asdffsa
+df
+sf
+sa
+fas
+f
+asf
+as
+f
+samefsfas
+f
+
+fsa
+df
+dsafas
+f
+
+
+asdffsadsa
+
+
+s
+a
+s
+dfa
+dsf
+dsfa
+f
+
+
+adsf
+
+asdf
+d
+fsasf
+d
+f
+sda
+
+
+
+fasd
+
+dasf
+
+dsf
+dsaasdf
+
+
+
+asdf
+
+dsa
+dfs
+dsafsd
+afterd
+
+
+
+sdfa
+
+sdf
+d
+fsasfd
+asdffsadfs
+
+
+dfsa
+fds
+fds
+afds
+f
+
+
+dsafsd
+
+dsf
+dfs
+a
+daf
+fds
+
+fds
+
+dsafsd
+
+
+[section:sign_extend Sign Extending functions]
+EEEEEE
+[endsect]
+
+[endsect]
+
 [section:minmax Compile time min/max calculation]
 
 The class templates in [@../../../../boost/integer/static_min_max.hpp <boost/integer/static_min_max.hpp>]

Modified: sandbox/SOC/2010/bits_and_ints/libs/integer/test/Jamfile.v2
==============================================================================
--- sandbox/SOC/2010/bits_and_ints/libs/integer/test/Jamfile.v2 (original)
+++ sandbox/SOC/2010/bits_and_ints/libs/integer/test/Jamfile.v2 2010-05-31 19:20:17 EDT (Mon, 31 May 2010)
@@ -16,6 +16,7 @@
         [ run static_log2_test.cpp ]
         [ run static_min_max_test.cpp ]
                 [ run sign_extend_test.cpp ]
+ [ run bit_reversal_test.cpp ]
         [ compile cstdint_include_test.cpp ]
         [ compile integer_traits_include_test.cpp ]
         [ compile integer_include_test.cpp ]

Added: sandbox/SOC/2010/bits_and_ints/libs/integer/test/bit_reversal_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/bits_and_ints/libs/integer/test/bit_reversal_test.cpp 2010-05-31 19:20:17 EDT (Mon, 31 May 2010)
@@ -0,0 +1,119 @@
+// Boost bit_reversal_test.hpp test program --------------------------------------//
+
+// (C) Copyright Murilo Adriano Vasconcelos 2010.
+// 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
+
+#include <boost/detail/lightweight_test.hpp>
+
+#include <boost/cstdlib.hpp> // for boost::exit_success
+#include <boost/integer/bits_and_ints.hpp>
+
+#include <iostream> // for std::cout (std::endl indirectly)
+
+
+// Macros to compact code
+#define BIT_REVERSAL_TEST(n, m) \
+ BOOST_TEST(::boost::bit_reversal(n) == m)
+
+#define STATIC_BIT_REVERSAL_TEST(t, n, m) \
+ BOOST_TEST((::boost::static_bit_reversal<t, n>::value == m))
+
+
+// Main testing function
+int main(int, char* [])
+{
+ std::cout << "Doing tests on bit_reversal." << std::endl;
+
+ BIT_REVERSAL_TEST(unsigned(0), unsigned(0));
+ BIT_REVERSAL_TEST(unsigned(1), unsigned(1 << 31));
+
+ for (unsigned i = 2, val, acc = 2; i < 32; ++i) {
+ val = unsigned(1 << (32 - i));
+ BIT_REVERSAL_TEST(acc, val);
+ acc *= 2;
+ }
+
+ STATIC_BIT_REVERSAL_TEST(unsigned, 0, 0);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 1, unsigned(1) << 31);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 2, unsigned(1) << 30);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 4, unsigned(1) << 29);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 8, unsigned(1) << 28);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 16, unsigned(1) << 27);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 32, unsigned(1) << 26);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 64, unsigned(1) << 25);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 128, unsigned(1) << 24);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 256, unsigned(1) << 23);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 512, unsigned(1) << 22);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 1024, unsigned(1) << 21);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 2048, unsigned(1) << 20);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 4096, unsigned(1) << 19);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 8192, unsigned(1) << 18);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 16384, unsigned(1) << 17);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 32768, unsigned(1) << 16);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 65536, unsigned(1) << 15);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 131072, unsigned(1) << 14);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 262144, unsigned(1) << 13);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 524288, unsigned(1) << 12);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 1048576, unsigned(1) << 11);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 2097152, unsigned(1) << 10);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 4194304, unsigned(1) << 9);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 8388608, unsigned(1) << 8);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 16777216, unsigned(1) << 7);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 33554432, unsigned(1) << 6);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 67108864, unsigned(1) << 5);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 134217728, unsigned(1) << 4);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 268435456, unsigned(1) << 3);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 536870912, unsigned(1) << 2);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 1073741824, unsigned(1) << 1);
+ STATIC_BIT_REVERSAL_TEST(unsigned, 2147483648, unsigned(1));
+
+
+#ifndef BOOST_NO_INT64_T
+ BIT_REVERSAL_TEST(uint64_t(0), uint64_t(0));
+ BIT_REVERSAL_TEST(uint64_t(1), uint64_t(1) << 63);
+
+ uint64_t acc = 2, val;
+ for (unsigned i = 2; i < 64; ++i) {
+ val = uint64_t(1) << (64 - i);
+ BIT_REVERSAL_TEST(acc, val);
+ acc *= 2;
+ }
+
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 0, 0);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 1, uint64_t(1) << 63);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 2, uint64_t(1) << 62);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 4, uint64_t(1) << 61);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 8, uint64_t(1) << 60);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 16, uint64_t(1) << 59);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 32, uint64_t(1) << 58);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 64, uint64_t(1) << 57);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 128, uint64_t(1) << 56);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 256, uint64_t(1) << 55);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 512, uint64_t(1) << 54);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 1024, uint64_t(1) << 53);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 2048, uint64_t(1) << 52);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 4096, uint64_t(1) << 51);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 8192, uint64_t(1) << 50);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 16384, uint64_t(1) << 49);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 32768, uint64_t(1) << 48);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 65536, uint64_t(1) << 47);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 131072, uint64_t(1) << 46);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 262144, uint64_t(1) << 45);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 524288, uint64_t(1) << 44);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 1048576, uint64_t(1) << 43);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 2097152, uint64_t(1) << 42);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 4194304, uint64_t(1) << 41);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 8388608, uint64_t(1) << 40);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 16777216, uint64_t(1) << 39);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 33554432, uint64_t(1) << 38);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 67108864, uint64_t(1) << 37);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 134217728, uint64_t(1) << 36);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 268435456, uint64_t(1) << 35);
+ STATIC_BIT_REVERSAL_TEST(uint64_t, 536870912, uint64_t(1) << 34);
+#endif
+
+ return boost::report_errors();
+}
+

Modified: sandbox/SOC/2010/bits_and_ints/libs/integer/test/sign_extend_test.cpp
==============================================================================
--- sandbox/SOC/2010/bits_and_ints/libs/integer/test/sign_extend_test.cpp (original)
+++ sandbox/SOC/2010/bits_and_ints/libs/integer/test/sign_extend_test.cpp 2010-05-31 19:20:17 EDT (Mon, 31 May 2010)
@@ -3,7 +3,7 @@
 // (C) Copyright Murilo Adriano Vasconcelos 2010.
 // 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)
+// http://www.boost.org/LICENSE_1_0.txt
 
 
 #include <boost/detail/lightweight_test.hpp>
@@ -65,7 +65,7 @@
 #ifndef BOOST_NO_INT64_T
         SIGN_EXTEND_TEST(0x7FFFFFFFFF, 39, 0xFFFFFFFFFFFFFFFF);
         SIGN_EXTEND_TEST(0x1000000000000000, 63, 0x1000000000000000);
- SIGN_EXTEND_TEST(0x7FFFFFFFFFFFFFFF, 63, -0x1);
+ SIGN_EXTEND_TEST(0x7FFFFFFFFFFFFFFF, 63, (uint64_t)-0x1);
 #endif
         
         return boost::report_errors();


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk