diff -r 000000000000 -r 83f4b4db085c toolsandutils/e32tools/compress/byte_pair.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toolsandutils/e32tools/compress/byte_pair.h Tue Feb 02 01:39:43 2010 +0200 @@ -0,0 +1,82 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef BYTE_PAIR_H +#define BYTE_PAIR_H + +#ifdef __VC32__ +#ifdef __MSVCDOTNET__ +#include +#include +#else //!__MSVCDOTNET__ +#include +#include +#endif //__MSVCDOTNET__ +#else // !__VC32__ +#ifdef __TOOLS2__ +#include +#include +using namespace std; +#else +#include +#include +#endif +#endif // __VC32__ + + + +#include +const TInt MaxBlockSize = 0x1000; +class CBytePair { + private: + TBool iFastCompress; + TUint16 PairCount[0x10000]; + TUint16 PairBuffer[MaxBlockSize*2]; + TInt PairsFound; + + TUint16 GlobalPairs[0x10000]; + TUint16 GlobalTokenCounts[0x100]; + + TUint16 ByteCount[0x100+4]; + + void CountBytes(TUint8* data, TInt size) { + memset(ByteCount,0,sizeof(ByteCount)); + TUint8* dataEnd = data+size; + while(data