From ac54d187bc9b658667a4cba561a17fa68517de1a Mon Sep 17 00:00:00 2001 From: rich_sposato Date: Thu, 16 Sep 2010 17:23:59 +0000 Subject: [PATCH] Replaced repeated calculation with local variable. git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@1075 7ec92016-0320-0410-acc4-a06ded1c099a --- src/SmallObj.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/SmallObj.cpp b/src/SmallObj.cpp index 89da338..8fb17b4 100644 --- a/src/SmallObj.cpp +++ b/src/SmallObj.cpp @@ -943,18 +943,19 @@ bool FixedAllocator::Deallocate( void * p, Chunk * hint ) assert( CountEmptyChunks() < 2 ); Chunk * foundChunk = nullptr; - if ( ( nullptr != hint ) && ( hint->HasBlock( p, numBlocks_ * blockSize_ ) ) ) + const ::std::size_t chunkLength = numBlocks_ * blockSize_; + if ( ( nullptr != hint ) && ( hint->HasBlock( p, chunkLength ) ) ) foundChunk = hint; - else if ( deallocChunk_->HasBlock( p, numBlocks_ * blockSize_ ) ) + else if ( deallocChunk_->HasBlock( p, chunkLength ) ) foundChunk = deallocChunk_; - else if ( allocChunk_->HasBlock( p, numBlocks_ * blockSize_ ) ) + else if ( allocChunk_->HasBlock( p, chunkLength ) ) foundChunk = allocChunk_; else foundChunk = VicinityFind( p ); if ( nullptr == foundChunk ) return false; - assert( foundChunk->HasBlock( p, numBlocks_ * blockSize_ ) ); + assert( foundChunk->HasBlock( p, chunkLength ) ); #ifdef LOKI_CHECK_FOR_CORRUPTION if ( foundChunk->IsCorrupt( numBlocks_, blockSize_, true ) ) {