From b458c22e5421f4d0fd23cdf14c072d132a820937 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Fri, 24 Sep 2010 15:25:26 +1000 Subject: Added GetRange method to SplitVector as fast way to retrieve elements. --- src/CellBuffer.cxx | 5 +---- src/SplitVector.h | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index 064ef1a2a..de1605837 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -351,10 +351,7 @@ void CellBuffer::GetCharRange(char *buffer, int position, int lengthRetrieve) co lengthRetrieve, substance.Length()); return; } - - for (int i=0; i part1AfterPosition) + range1Length = part1AfterPosition; + } + memcpy(buffer, body + position, range1Length * sizeof(T)); + buffer += range1Length; + position = position + range1Length + gapLength; + int range2Length = retrieveLength - range1Length; + memcpy(buffer, body + position, range2Length * sizeof(T)); + } + T *BufferPointer() { RoomFor(1); GapTo(lengthBody); -- cgit v1.2.3