Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r72025 - sandbox/block_ptr/boost
From: phil_at_[hidden]
Date: 2011-05-18 00:13:19


Author: pbouchard
Date: 2011-05-18 00:13:17 EDT (Wed, 18 May 2011)
New Revision: 72025
URL: http://svn.boost.org/trac/boost/changeset/72025

Log:
* Optimimzed redir
Text files modified:
   sandbox/block_ptr/boost/block_ptr.hpp | 16 ++++++++--------
   1 files changed, 8 insertions(+), 8 deletions(-)

Modified: sandbox/block_ptr/boost/block_ptr.hpp
==============================================================================
--- sandbox/block_ptr/boost/block_ptr.hpp (original)
+++ sandbox/block_ptr/boost/block_ptr.hpp 2011-05-18 00:13:17 EDT (Wed, 18 May 2011)
@@ -70,7 +70,7 @@
 #endif
 
     count_type count_; /**< Count of the number of pointers from the stack referencing the same @c block_header .*/
- block_header * redir_; /**< Redirection in the case of an union multiple sets.*/
+ mutable block_header * redir_; /**< Redirection in the case of an union multiple sets.*/
 
         bool destroy_; /**< Destruction sequence initiated. */
     intrusive_list::node tag_; /**< Tag used to enlist to @c block_header::includes_ . */
@@ -134,6 +134,8 @@
             
         while (p != p->redir_)
                 p = p->redir_;
+
+ redir_ = p;
         
         return p;
     }
@@ -147,11 +149,9 @@
 
     void redir(block_header * p)
     {
- block_header * q = p->redir();
-
- if (redir_ != q)
+ if (redir_ != p)
         {
- redir_ = q;
+ redir_ = p;
             redir_->includes_.merge(includes_);
             redir_->elements_.merge(elements_);
             new (& redir_->count_) count_type(redir_->count_ + count_); /**< Hack */
@@ -333,7 +333,7 @@
                 else
                     pool::top(this)->ptrs_.push(& pn_);
 
- ps_->redir(p.ps_);
+ ps_->redir()->redir(p.ps_->redir());
             }
 
                 
@@ -350,7 +350,7 @@
                 else
                     pool::top(this)->ptrs_.push(& pn_);
                                 
- ps_->redir(p.ps_);
+ ps_->redir()->redir(p.ps_->redir());
             }
 
 
@@ -371,7 +371,7 @@
                 {
                     release(false);
                                         
- ps_->redir(p.ps_);
+ ps_->redir()->redir(p.ps_->redir());
                 }
                 base::operator = (p);
 


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