speed optimization

This commit is contained in:
Volker Fischer 2013-12-16 20:36:48 +00:00
parent 379a3e9f9d
commit cbaefb32da
2 changed files with 18 additions and 10 deletions

View file

@ -204,11 +204,13 @@ public:
else
{
// data can be written in one step
const int iEnd = iPutPos + iInSize;
while ( iPutPos < iEnd )
{
vecMemory[iPutPos++] = vecData[iCurPos++];
}
std::copy ( vecData.begin(),
vecData.begin() + iInSize,
vecMemory.begin() + iPutPos );
// set the put position one block further (no wrap around needs
// to be considered here)
iPutPos += iInSize;
}
}
@ -269,11 +271,16 @@ public:
else
{
// data can be read in one step
const int iEnd = iGetPos + iInSize;
while ( iGetPos < iEnd )
{
vecData[iCurPos++] = vecMemory[iGetPos++];
}
const std::vector<TData>::const_iterator ItMemoryGetPos =
vecMemory.begin() + iGetPos;
std::copy ( ItMemoryGetPos,
ItMemoryGetPos + iInSize,
vecData.begin() );
// set the get position one block further (no wrap around needs
// to be considered here)
iGetPos += iInSize;
}
}

View file

@ -37,6 +37,7 @@
#include <QUrl>
#include <QLocale>
#include <vector>
#include <algorithm>
#include "global.h"
using namespace std; // because of the library: "vector"
#ifdef _WIN32