Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63067 - in sandbox/SOC/2010/bit_masks: boost/integer lib/integer/test/bft_testing
From: bbartmanboost_at_[hidden]
Date: 2010-06-17 18:13:29


Author: bbartman
Date: 2010-06-17 18:13:28 EDT (Thu, 17 Jun 2010)
New Revision: 63067
URL: http://svn.boost.org/trac/boost/changeset/63067

Log:
fixed my negative value problem
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp | 10 +++++-----
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/get_interface_test.cpp | 15 +++++++++++----
   2 files changed, 16 insertions(+), 9 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-17 18:13:28 EDT (Thu, 17 Jun 2010)
@@ -63,7 +63,6 @@
          */
         typedef typename MaskInfo::return_type return_type;
         typedef bit_ref<MaskInfo> _self;
- typedef typename make_unsigned<return_type>::type unsigned_return_type;
         typedef typename make_unsigned<
             storage_type
>::type unsigned_storage_type;
@@ -74,7 +73,8 @@
         typedef typename integer::bitfield<
             unsigned_storage_type,
             MaskInfo::offset::value,
- MaskInfo::offset::value + MaskInfo::field_width::value - 1
+ MaskInfo::offset::value + MaskInfo::field_width::value - 1,
+ return_type
> bitfield_type;
 
 
@@ -113,8 +113,7 @@
          * the tuple like interface.
          */
         _self const& operator=(return_type const& rhs) {
- _ref.set(
- static_cast<typename make_unsigned<storage_type>::type>(rhs));
+ _ref.set( rhs );
             return *this;
         }
         
@@ -149,7 +148,8 @@
         typedef typename integer::bitfield<
             unsigned_storage_type,
             MaskInfo::offset::value,
- MaskInfo::offset::value + MaskInfo::field_width::value - 1
+ MaskInfo::offset::value + MaskInfo::field_width::value - 1,
+ return_type
> bitfield_type;
 
 

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/get_interface_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/get_interface_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/get_interface_test.cpp 2010-06-17 18:13:28 EDT (Thu, 17 Jun 2010)
@@ -29,10 +29,10 @@
     {
         test_tuple test_1;
         test_1.get<green>() = 15;
- test_1.get<red>() = 14;
+ test_1.get<red>() = 3;
         test_1.get<salmon>() = 6;
         BOOST_ASSERT((test_1.get<green>() == 15));
- BOOST_ASSERT((test_1.get<red>() == 14));
+ BOOST_ASSERT((test_1.get<red>() == 3));
         BOOST_ASSERT(( test_1.get<salmon>() == 6));
 
         BOOST_ASSERT((
@@ -45,10 +45,10 @@
     // get using an index.
     {
         test_tuple test_2;
- test_2.get<0>() = 15;
+ test_2.get<0>() = 3;
         test_2.get<1>() = 14;
         test_2.get<2>() = 6;
- BOOST_ASSERT((test_2.get<0>() == 15));
+ BOOST_ASSERT((test_2.get<0>() == 3));
         BOOST_ASSERT((test_2.get<1>() == 14));
         BOOST_ASSERT((test_2.get<2>() == 6));
 
@@ -58,6 +58,13 @@
>(test_2).get<2>() == 6
         ));
     }
+
+ // negative value testing
+ {
+ test_tuple test_3;
+ test_3.get<0>() = -1;
+ BOOST_ASSERT(( test_3.get<0>() == -1 ));
+ }
     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