Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64523 - sandbox/SOC/2010/bit_masks/boost/integer
From: bbartmanboost_at_[hidden]
Date: 2010-08-01 12:29:28


Author: bbartman
Date: 2010-08-01 12:29:27 EDT (Sun, 01 Aug 2010)
New Revision: 64523
URL: http://svn.boost.org/trac/boost/changeset/64523

Log:
worked on the function which computes the resizing the bitfield_vector

Text files modified:
   sandbox/SOC/2010/bit_masks/boost/integer/bitfield_vector.hpp | 18 +++++++++++++++++-
   1 files changed, 17 insertions(+), 1 deletions(-)

Modified: sandbox/SOC/2010/bit_masks/boost/integer/bitfield_vector.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/bitfield_vector.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/bitfield_vector.hpp 2010-08-01 12:29:27 EDT (Sun, 01 Aug 2010)
@@ -140,7 +140,23 @@
 
 protected:
     void check_for_resizing() {
- // next_allocation_size<Width>
+ size_type size_of_alloc = (this->_impl._end - this->_impl._start);
+ difference_type remaing_bits = ((size_of_alloc*8) - this->_impl._bits_in_use);
+ if(remaing_bits < Width) {
+ std::size_t next_allocation_size =
+ detail::next_allocation_size<Width>()(
+ size_of_alloc,
+ this->_impl._bits_in_use
+ );
+ pointer ptr = this->allocate_impl( next_allocation_size );
+
+ std::memcpy(static_cast<void*>(ptr),
+ static_cast<void*>(this->_impl._start),
+ size_of_alloc);
+ this->deallocate_impl(this->_impl._start, size_of_alloc);
+ this->_impl._start = ptr;
+ this->_impl._end = ptr + next_allocation_size;
+ }
     }
 };
 


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