Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64685 - in sandbox/SOC/2010/bit_masks: boost/integer/detail/bitfield_vector lib/integer/test/bitfield_vector_testing
From: bbartmanboost_at_[hidden]
Date: 2010-08-08 12:11:46


Author: bbartman
Date: 2010-08-08 12:11:44 EDT (Sun, 08 Aug 2010)
New Revision: 64685
URL: http://svn.boost.org/trac/boost/changeset/64685

Log:
finished trivial storage case for bitfield_vector
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/integer/detail/bitfield_vector/bitfield_vector_member_impl.hpp | 16 ++++++++++
   sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/proxy_reference_test.cpp | 55 ++++++++++++++++++++++++++++++++++++---
   2 files changed, 65 insertions(+), 6 deletions(-)

Modified: sandbox/SOC/2010/bit_masks/boost/integer/detail/bitfield_vector/bitfield_vector_member_impl.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/detail/bitfield_vector/bitfield_vector_member_impl.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/detail/bitfield_vector/bitfield_vector_member_impl.hpp 2010-08-08 12:11:44 EDT (Sun, 08 Aug 2010)
@@ -14,6 +14,9 @@
 #include <boost/type_traits/is_signed.hpp>
 #include <boost/assert.hpp>
 #include <cstring>
+#include <boost/integer/low_bits_mask.hpp>
+#include <iostream>
+#include <iomanip>
 
 namespace boost { namespace detail {
 
@@ -211,7 +214,19 @@
 
     /** value_type storage assignement operator.*/
     _self& operator=(value_type x) {
+ if(_mask._size == 1) {
+ storage_t previous_values = *_ptr & ~_mask._first_byte;
+ storage_t new_value = low_bits_mask<value_type, width>::value & x;
+ new_value <<= _mask._last_shift;
+ previous_values |= new_value;
+ *_ptr = previous_values;
+ return *this;
+ }
+
+ if(_mask._size == 2) {
+ }
         
+ return *this;
     }
 
     bool operator==(_self const& rhs);
@@ -223,7 +238,6 @@
     /** Member variables. */
     storage_type* _ptr;
     mask_detail _mask;
- // mask_array_info _mask;
 };
 
 

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/proxy_reference_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/proxy_reference_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/proxy_reference_test.cpp 2010-08-08 12:11:44 EDT (Sun, 08 Aug 2010)
@@ -218,7 +218,8 @@
         ptr = storage;
         print_type_and_value(t6);
         print_mask_details(t6);
- BOOST_TEST(t6 == 0xFFFFFFFFFF);
+ typedef unsigned long long ullt;
+ BOOST_TEST(t6 == ullt(0xFFFFFFFFFF));
 
 
         // testing multi byte > 2 and ending with 0xFF
@@ -252,13 +253,57 @@
         // 8
         *ptr = 0xFE;
         ++ptr;
- *ptr = 0xFF;
- ++ptr;
- *ptr = 0xFF;
         ptr = storage;
         print_type_and_value(t7);
         print_mask_details(t7);
- BOOST_TEST(t7 == 0x7fffffffffffffff);
+ BOOST_TEST(t7 == 0x7fffffffffffffff );
+ }
+
+ // testing value_type assignment operator.
+ {
+ std::cout << "-----------------------------------------" << std::endl;
+ std::cout << "Testing assignment value_type assignement operator" << std::endl;
+ std::cout << "-----------------------------------------" << std::endl
+ << std::endl<< std::endl;
+ std::cout << "-----------------------------------------" << std::endl;
+ std::cout << "1 byte offset 0" << std::endl;
+ std::cout << "-----------------------------------------" << std::endl;
+ typedef unsigned char storage_type;
+ typedef storage_type* storage_ptr;
+ storage_type storage[20];
+ storage_ptr ptr = storage;
+ std::memset(ptr,0,20);
+
+ test_type_1 t1(ptr, 0);
+ t1 = 0x7;
+ std::cout << std::hex << std::size_t(*ptr) << std::endl;
+ print_mask_details(t1);
+ BOOST_TEST(*ptr == 0xE0);
+
+
+ std::cout << "-----------------------------------------" << std::endl;
+ std::cout << "1 byte offset not 2" << std::endl;
+ std::cout << "-----------------------------------------" << std::endl;
+
+ std::memset(ptr,0,1);
+
+ test_type_1 t2(ptr, 2);
+ t2 = 0x7;
+ std::cout << std::hex << std::size_t(*ptr) << std::endl;
+ print_mask_details(t2);
+ BOOST_TEST(*ptr == 0x38);
+/*
+test_type_1;
+test_type_2;
+test_type_3;
+test_type_4;
+test_type_5;
+test_type_6;
+test_type_7;
+test_type_8;
+test_type_9;
+test_type_10;
+*/
     }
     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