|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r64683 - 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 10:43:46
Author: bbartman
Date: 2010-08-08 10:43:45 EDT (Sun, 08 Aug 2010)
New Revision: 64683
URL: http://svn.boost.org/trac/boost/changeset/64683
Log:
finished most of the testing for proxy_reference_type there is one more test case to touch before I move on to the next part of the proxy refence types testing
Text files modified:
sandbox/SOC/2010/bit_masks/boost/integer/detail/bitfield_vector/bitfield_vector_member_impl.hpp | 8 ++------
sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/proxy_reference_test.cpp | 32 +++++++++++++++++++++++++++-----
sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/test_utility.hpp | 8 +++++---
3 files changed, 34 insertions(+), 14 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 10:43:45 EDT (Sun, 08 Aug 2010)
@@ -15,7 +15,6 @@
#include <boost/assert.hpp>
#include <cstring>
-
namespace boost { namespace detail {
template <std::size_t Width, bool = bool((Width%8) > 0)>
@@ -204,11 +203,8 @@
++byte_ptr;
}
// shifting bits
- if(_mask._last_shift == 8){
- ret <<= 8;
- }else{
- ret <<= 8 - _mask._last_shift;
- }
+
+ ret <<= 8 - _mask._last_shift;
ret += value_type( *byte_ptr & _mask._last_byte ) >> ( _mask._last_shift);
return ret;
}
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 10:43:45 EDT (Sun, 08 Aug 2010)
@@ -179,26 +179,48 @@
std::cout << "Multi byte mask > 2 bytes" << std::endl;
std::cout << "0 offset" << std::endl;
std::cout << "-----------------------------------------" << std::endl;
- ptr = storage;
test_type_4 t5(ptr,0);
print_type_and_value(t5);
print_mask_details(t5);
std::memset(ptr,0,4);
*ptr = 0xFF;
- std::cout << std::hex<< std::size_t(*ptr) << std::endl;
++ptr;
*ptr = 0xFF;
- std::cout << std::hex<< std::size_t(*ptr) << std::endl;
++ptr;
*ptr = 0x80;
- std::cout << std::hex<< std::size_t(*ptr) << std::endl;
ptr = storage;
// expected mask
// 0xFF 0xFF 0x80
BOOST_TEST(t5 == 0x1FFFF);
-
+
+ // testing multi byte > 2 and ending with 0xFF
+ std::cout << "-----------------------------------------" << std::endl;
+ std::cout << "Multi byte mask > 2 bytes and ending with 0xFF" << std::endl;
+ std::cout << "0 offset" << std::endl;
+ std::cout << "-----------------------------------------" << std::endl;
+ proxy_reference_type<unsigned long long, 48> t6(ptr,0);
+ std::memset(ptr,0,4);
+
+ // 0xFFFFFFFFFFFF
+ *ptr = 0xFF;
+ ++ptr;
+ *ptr = 0xFF;
+ ++ptr;
+ *ptr = 0xFF;
+ ++ptr;
+ *ptr = 0xFF;
+ ++ptr;
+ *ptr = 0xFF;
+ ++ptr;
+ *ptr = 0xFF;
+
+ ptr = storage;
+ print_type_and_value(t6);
+ print_mask_details(t6);
+ // ff ff ff ff ff
+ BOOST_TEST(t6 == 0xFFFFFFFFFF);
}
return boost::report_errors();
}
Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/test_utility.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/test_utility.hpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/test_utility.hpp 2010-08-08 10:43:45 EDT (Sun, 08 Aug 2010)
@@ -55,19 +55,21 @@
template<typename T>
void print_type_and_value( T const& x) {
+ typedef unsigned long long ulltype;
std::cout << "Type: " << typestr<T>() << " Value:"
- << std::hex << std::size_t(x) << std::endl;
+ << std::hex << ulltype(x) << std::endl;
}
template <typename T>
void print_mask_details( T const& x) {
+ typedef unsigned long long ulltype;
std::cout << "Mask detail for the following class" << std::endl;
std::cout << "Type: " << typestr<T>() << std::endl;
std::cout << "Mask Values" << std::endl;
std::cout << "size:" << x._mask._size << std::endl;
std::cout << "offset:" << x._mask._offset << std::endl;
- std::cout << "first_byte:" << std::hex << std::size_t(x._mask._first_byte) << std::endl;
- std::cout << "last_byte:" << std::hex << std::size_t(x._mask._last_byte) << std::endl;
+ std::cout << "first_byte:" << std::hex << ulltype(x._mask._first_byte) << std::endl;
+ std::cout << "last_byte:" << std::hex << ulltype(x._mask._last_byte) << std::endl;
std::cout << "last_shift:" << x._mask._last_shift << std::endl << std::endl;
}
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