Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62764 - in sandbox/SOC/2010/bit_masks: boost/integer lib/integer/test lib/integer/test/bft_testing
From: bbartmanboost_at_[hidden]
Date: 2010-06-10 16:27:33


Author: bbartman
Date: 2010-06-10 16:27:33 EDT (Thu, 10 Jun 2010)
New Revision: 62764
URL: http://svn.boost.org/trac/boost/changeset/62764

Log:
completed work and testing for the reference type inside the bitfield_tuple class
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp | 8 +++---
   sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 | 1
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/ref_type_testing.cpp | 43 ++++++++++++++++++++++++++++++++++++++++
   3 files changed, 48 insertions(+), 4 deletions(-)

Modified: sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp 2010-06-10 16:27:33 EDT (Thu, 10 Jun 2010)
@@ -422,9 +422,9 @@
          */
         typedef typename MaskInfo::return_type return_type;
         typedef bits_mask<
- typename MaskInfo::storage_type,
- MaskInfo::offset,
- MaskInfo::field_width
+ storage_type,
+ MaskInfo::offset::value,
+ MaskInfo::field_width::value
> mask;
 
         typedef bit_ref<MaskInfo> _self;
@@ -444,7 +444,7 @@
 
         _self const& operator=(return_type const& rhs) {
             _ref ^= (_ref & mask());
- _ref |= (static_cast<storage_type>(rhs) << mask::offset);
+ _ref |= ((static_cast<storage_type>(rhs) << mask::offset) & mask());
             return *this;
         }
         

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-06-10 16:27:33 EDT (Thu, 10 Jun 2010)
@@ -31,5 +31,6 @@
         [ compile-fail bft_testing/compile_fail/bft_storage_width_acceded.cpp ]
         [ compile bft_testing/compile_pass/bft_member_max_out.cpp ]
         [ run bitfield_tuple_test.cpp ]
+ [ run bft_testing/ref_type_testing.cpp ]
     ;
 

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/ref_type_testing.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/ref_type_testing.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/ref_type_testing.cpp 2010-06-10 16:27:33 EDT (Thu, 10 Jun 2010)
@@ -0,0 +1,43 @@
+// Copyright 2010 Brian Bartman.
+// 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/integer/bitfield_tuple.hpp>
+#include <boost/assert.hpp>
+using namespace boost;
+struct red { };
+
+
+
+typedef bitfield_tuple<
+ storage<int>,
+ member<int, red, 15u>,
+ member<int, red, 17u>
+> bft;
+
+
+
+
+int main() {
+
+ int data_storage(0);
+ typedef details::bitfield_element_<
+ char,
+ red,
+ mpl::size_t<9>,
+ mpl::size_t<8>
+ > element;
+
+ typedef bft::bit_ref<element> ref_type_1;
+
+ ref_type_1 test_1(data_storage);
+
+ // char temp = test_1;
+ char value_to_assign = 'a';
+ test_1 = value_to_assign;
+ BOOST_ASSERT(( data_storage >> 9 == 'a' ));
+
+ 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