|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r61945 - in sandbox/SOC/2010/bit_masks: boost/integer boost/integer/details lib/integer/test
From: bbartmanboost_at_[hidden]
Date: 2010-05-13 10:24:03
Author: bbartman
Date: 2010-05-13 10:24:02 EDT (Thu, 13 May 2010)
New Revision: 61945
URL: http://svn.boost.org/trac/boost/changeset/61945
Log:
working on testing low_bit_maks and wanted to make sure that what I have gets commiteD
Text files modified:
sandbox/SOC/2010/bit_masks/boost/integer/bit_mask.hpp | 8 +++++---
sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_impl.hpp | 11 ++++++++---
sandbox/SOC/2010/bit_masks/boost/integer/high_low_bits.hpp | 27 +++++++++++++++++++++++++++
sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 | 2 ++
sandbox/SOC/2010/bit_masks/lib/integer/test/low_bit_mask_test.cpp | 38 ++++++++++++++++++++++++++++++++++++++
5 files changed, 80 insertions(+), 6 deletions(-)
Modified: sandbox/SOC/2010/bit_masks/boost/integer/bit_mask.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/bit_mask.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/bit_mask.hpp 2010-05-13 10:24:02 EDT (Thu, 13 May 2010)
@@ -4,8 +4,8 @@
// 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_INTEGER_BIT_MASK_HPP
#define BOOST_INTEGER_BIT_MASK_HPP
@@ -22,10 +22,12 @@
* Mask which creates a mask give type, offset and width of the mask
*/
template <typename T, typename Offset, typename Width>
-struct bit_maks
+struct bit_mask
{ };
-
+template <typename T, T Value>
+struct integral_mask
+{ };
} // namespace boost
Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_impl.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_impl.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_impl.hpp 2010-05-13 10:24:02 EDT (Thu, 13 May 2010)
@@ -1,3 +1,9 @@
+// (C) Copyright Brian Bartman 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_MASK_IMPL_HPP
#define BOOST_BIT_MASK_IMPL_HPP
@@ -77,9 +83,8 @@
/** bit_mask_impl specialization over an mpl type. */
template < typename MaskedType, typename IntegralType, IntegralType IntegralValue>
-struct bit_mask_impl< MaskedType, mpl::integral_c<IntegralType, IntegralValue>, unused_type>{
-
-};
+struct bit_mask_impl< MaskedType, mpl::integral_c<IntegralType, IntegralValue>, unused_type>
+{ };
} // end of details namespace.
} // end of boost namespace.
Modified: sandbox/SOC/2010/bit_masks/boost/integer/high_low_bits.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/high_low_bits.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/high_low_bits.hpp 2010-05-13 10:24:02 EDT (Thu, 13 May 2010)
@@ -0,0 +1,27 @@
+// (C) Copyright Brian Bartman 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_HIGH_LOW_BIT_HPP
+#define BOOST_HIGH_LOW_BIT_HPP
+
+#include <boost/mpl/integral_c.hpp>
+#include <boost/type_traits.hpp>
+
+namespace boost {
+
+template <typename T, T Width>
+struct low_bits
+ :integral_constant<T, (~T(0) << Width) >
+{
+ // typedef integral_constant<T, (~T(0) << Width) > integral_type;
+ // using integral_type::value;
+ // using integral_type::type;
+};
+
+} // namespace boost
+
+#endif
Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 2010-05-13 10:24:02 EDT (Thu, 13 May 2010)
@@ -13,3 +13,5 @@
[ run low_bit_mask_test.cpp ]
[ compile bit_mask_test.cpp ]
;
+
+# run low_bit_mask_test.cpp
Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/low_bit_mask_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/low_bit_mask_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/low_bit_mask_test.cpp 2010-05-13 10:24:02 EDT (Thu, 13 May 2010)
@@ -1,6 +1,44 @@
+#include <boost/test/execution_monitor.hpp>
+#include <boost/assert.hpp>
+#include <boost/type_traits.hpp>
#include <boost/integer/high_low_bits.hpp>
+#include <except>
+#include <string.h>
+// Testing of low_bits function.
+
+
+
+using namespace std;
+using namespace boost;
+
+
+struct bit_exception
+ :except
+{
+ void setValue(char* c) {
+ m_value = c;
+ }
+
+ virtual const char* what() const {
+ return "Failure: value is: " + m_value + "\n";
+ }
+
+ char* m_value;
+};
+typedef low_bits<unsigned int, 3>::type lbits;
int main() {
+
+ bit_exception be;
+ be.setValue( );
+ throw(be);
+
+ // throw(lbits::value);
+ // std::cerr << lbits::value << std::endl;
+ BOOST_ASSERT(( is_same< lbits::type, unsigned int>::type::value ));
+ // BOOST_ASSERT(( lbits::value == 7 ));
+ // using namespace std;
+
return 0;
}
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