From 52fc35357ec2a0cc03f008496a0efb0eaa647e06 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Thu, 31 Dec 2009 16:58:48 +0000 Subject: [PATCH] added some more comments --- src/buffer.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/buffer.cpp b/src/buffer.cpp index dcca3e35..be099fd9 100755 --- a/src/buffer.cpp +++ b/src/buffer.cpp @@ -253,12 +253,19 @@ if ( bUseRandomInit ) const int iNumBlocks = iMemSize / iBlockSize; if ( iNumBlocks < iNumBlocksBoundForRandom ) // just for very small buffers { - // overwrite fill level with random value + // overwrite fill level with random value, the range + // is 0 to (iMemSize - iBlockSize) iNewFillLevel = static_cast ( static_cast ( rand() ) * iNumBlocks / RAND_MAX ) * iBlockSize; } } +/* +// TEST +static FILE* pFile = fopen ( "test.dat", "w" ); +fprintf ( pFile, "%d %d %d\n", iMemSize, iBlockSize, iNewFillLevel ); +fflush ( pFile ); +*/ } // different behaviour for get and put corrections @@ -267,7 +274,8 @@ if ( bUseRandomInit ) // clear buffer since we had a buffer underrun vecbyMemory.Reset ( 0 ); - // reset buffer pointers so that they are at maximum distance + // reset buffer pointers so that they are at maximum distance after + // the get operation (assign new fill level value to the get pointer) iPutPos = 0; iGetPos = iNewFillLevel;