diff options
author | Stefan Reinauer <stepan@coresystems.de> | 2010-04-27 06:56:47 +0000 |
---|---|---|
committer | Stefan Reinauer <stepan@openbios.org> | 2010-04-27 06:56:47 +0000 |
commit | 14e22779625de673569c7b950ecc2753fb915b31 (patch) | |
tree | 14a6ed759e116e9e6e9bbd7f499b74b96d6cc072 /util/cbfstool/lzma/C/7zip/Compress/LZ | |
parent | 0e1e8065e303030c39c3f2c27e5d32ee58a16c66 (diff) |
Since some people disapprove of white space cleanups mixed in regular commits
while others dislike them being extra commits, let's clean them up once and
for all for the existing code. If it's ugly, let it only be ugly once :-)
Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5507 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/cbfstool/lzma/C/7zip/Compress/LZ')
6 files changed, 34 insertions, 34 deletions
diff --git a/util/cbfstool/lzma/C/7zip/Compress/LZ/BinTree/BinTree.h b/util/cbfstool/lzma/C/7zip/Compress/LZ/BinTree/BinTree.h index b3b3f13a56..243d5a3888 100644 --- a/util/cbfstool/lzma/C/7zip/Compress/LZ/BinTree/BinTree.h +++ b/util/cbfstool/lzma/C/7zip/Compress/LZ/BinTree/BinTree.h @@ -2,13 +2,13 @@ #include "../LZInWindow.h" #include "../IMatchFinder.h" - + namespace BT_NAMESPACE { typedef UInt32 CIndex; const UInt32 kMaxValForNormalize = (UInt32(1) << 31) - 1; -class CMatchFinder: +class CMatchFinder: public IMatchFinder, public CLZInWindow, public CMyUnknownImp, @@ -40,7 +40,7 @@ class CMatchFinder: STDMETHOD_(Int32, NeedChangeBufferPos)(UInt32 numCheckBytes); STDMETHOD_(void, ChangeBufferPos)(); - STDMETHOD(Create)(UInt32 historySize, UInt32 keepAddBufferBefore, + STDMETHOD(Create)(UInt32 historySize, UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter); STDMETHOD(GetMatches)(UInt32 *distances); STDMETHOD(Skip)(UInt32 num); diff --git a/util/cbfstool/lzma/C/7zip/Compress/LZ/BinTree/BinTreeMain.h b/util/cbfstool/lzma/C/7zip/Compress/LZ/BinTree/BinTreeMain.h index 7a6f621a06..d47a03de90 100644 --- a/util/cbfstool/lzma/C/7zip/Compress/LZ/BinTree/BinTreeMain.h +++ b/util/cbfstool/lzma/C/7zip/Compress/LZ/BinTree/BinTreeMain.h @@ -25,7 +25,7 @@ namespace BT_NAMESPACE { static const UInt32 kMinMatchCheck = kNumHashBytes; static const UInt32 kStartMaxLen = 1; #else - #ifdef HASH_ZIP + #ifdef HASH_ZIP #define kNumHashDirectBytes 0 static const UInt32 kNumHashBytes = 3; static const UInt32 kHashSize = 1 << 16; @@ -73,11 +73,11 @@ void CMatchFinder::FreeMemory() } CMatchFinder::~CMatchFinder() -{ +{ FreeMemory(); } -STDMETHODIMP CMatchFinder::Create(UInt32 historySize, UInt32 keepAddBufferBefore, +STDMETHODIMP CMatchFinder::Create(UInt32 historySize, UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter) { if (historySize > kMaxValForNormalize - 256) @@ -85,15 +85,15 @@ STDMETHODIMP CMatchFinder::Create(UInt32 historySize, UInt32 keepAddBufferBefore FreeMemory(); return E_INVALIDARG; } - _cutValue = + _cutValue = #ifdef _HASH_CHAIN 8 + (matchMaxLen >> 2); #else 16 + (matchMaxLen >> 1); #endif - UInt32 sizeReserv = (historySize + keepAddBufferBefore + + UInt32 sizeReserv = (historySize + keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + 256; - if (CLZInWindow::Create(historySize + keepAddBufferBefore, + if (CLZInWindow::Create(historySize + keepAddBufferBefore, matchMaxLen + keepAddBufferAfter, sizeReserv)) { _matchMaxLen = matchMaxLen; @@ -161,8 +161,8 @@ STDMETHODIMP CMatchFinder::Init() } STDMETHODIMP_(void) CMatchFinder::ReleaseStream() -{ - // ReleaseStream(); +{ + // ReleaseStream(); } #ifdef HASH_ARRAY_2 @@ -173,7 +173,7 @@ STDMETHODIMP_(void) CMatchFinder::ReleaseStream() hash2Value = temp & (kHash2Size - 1); \ hash3Value = (temp ^ (UInt32(cur[2]) << 8)) & (kHash3Size - 1); \ hashValue = (temp ^ (UInt32(cur[2]) << 8) ^ (CCRC::Table[cur[3]] << 5)) & _hashMask; } - + #else // no HASH_ARRAY_3 #define HASH_CALC { \ UInt32 temp = CCRC::Table[cur[0]] ^ cur[1]; \ @@ -181,12 +181,12 @@ STDMETHODIMP_(void) CMatchFinder::ReleaseStream() hashValue = (temp ^ (UInt32(cur[2]) << 8)) & _hashMask; } #endif // HASH_ARRAY_3 #else // no HASH_ARRAY_2 -#ifdef HASH_ZIP +#ifdef HASH_ZIP inline UInt32 Hash(const Byte *pointer) { return ((UInt32(pointer[0]) << 8) ^ CCRC::Table[pointer[1]] ^ pointer[2]) & (kHashSize - 1); } -#else // no HASH_ZIP +#else // no HASH_ZIP inline UInt32 Hash(const Byte *pointer) { return pointer[0] ^ (UInt32(pointer[1]) << 8); @@ -205,7 +205,7 @@ STDMETHODIMP CMatchFinder::GetMatches(UInt32 *distances) if(lenLimit < kMinMatchCheck) { distances[0] = 0; - return MovePos(); + return MovePos(); } } @@ -298,17 +298,17 @@ STDMETHODIMP CMatchFinder::GetMatches(UInt32 *distances) UInt32 cyclicPos = (delta <= _cyclicBufferPos) ? (_cyclicBufferPos - delta): (_cyclicBufferPos - delta + _cyclicBufferSize); - CIndex *pair = son + + CIndex *pair = son + #ifdef _HASH_CHAIN cyclicPos; #else (cyclicPos << 1); #endif - + // _mm_prefetch((const char *)pair, _MM_HINT_T0); - + const Byte *pb = _buffer + curMatch; - UInt32 len = + UInt32 len = #ifdef _HASH_CHAIN kNumHashDirectBytes; if (pb[maxLen] == cur[maxLen]) @@ -369,7 +369,7 @@ STDMETHODIMP CMatchFinder::Skip(UInt32 num) #ifdef _HASH_CHAIN if (_streamPos - _pos < kNumHashBytes) { - RINOK(MovePos()); + RINOK(MovePos()); continue; } #else @@ -425,18 +425,18 @@ STDMETHODIMP CMatchFinder::Skip(UInt32 num) *ptr0 = *ptr1 = kEmptyHashValue; break; } - + UInt32 delta = _pos - curMatch; UInt32 cyclicPos = (delta <= _cyclicBufferPos) ? (_cyclicBufferPos - delta): (_cyclicBufferPos - delta + _cyclicBufferSize); CIndex *pair = son + (cyclicPos << 1); - + // _mm_prefetch((const char *)pair, _MM_HINT_T0); - + const Byte *pb = _buffer + curMatch; UInt32 len = MyMin(len0, len1); - + if (pb[len] == cur[len]) { while(++len != lenLimit) @@ -479,7 +479,7 @@ void CMatchFinder::Normalize() { UInt32 subValue = _pos - _cyclicBufferSize; CIndex *items = _hash; - UInt32 numItems = (_hashSizeSum + _cyclicBufferSize + UInt32 numItems = (_hashSizeSum + _cyclicBufferSize #ifndef _HASH_CHAIN * 2 #endif @@ -509,7 +509,7 @@ HRESULT CMatchFinder::MovePos() STDMETHODIMP_(Byte) CMatchFinder::GetIndexByte(Int32 index) { return CLZInWindow::GetIndexByte(index); } -STDMETHODIMP_(UInt32) CMatchFinder::GetMatchLen(Int32 index, +STDMETHODIMP_(UInt32) CMatchFinder::GetMatchLen(Int32 index, UInt32 back, UInt32 limit) { return CLZInWindow::GetMatchLen(index, back, limit); } @@ -527,5 +527,5 @@ STDMETHODIMP_(void) CMatchFinder::ChangeBufferPos() #undef HASH_CALC #undef kNumHashDirectBytes - + } diff --git a/util/cbfstool/lzma/C/7zip/Compress/LZ/IMatchFinder.h b/util/cbfstool/lzma/C/7zip/Compress/LZ/IMatchFinder.h index 8b8480b2d2..53b9c1ecc5 100644 --- a/util/cbfstool/lzma/C/7zip/Compress/LZ/IMatchFinder.h +++ b/util/cbfstool/lzma/C/7zip/Compress/LZ/IMatchFinder.h @@ -15,10 +15,10 @@ struct IInWindowStream: public IUnknown STDMETHOD_(Int32, NeedChangeBufferPos)(UInt32 numCheckBytes) PURE; STDMETHOD_(void, ChangeBufferPos)() PURE; }; - + struct IMatchFinder: public IInWindowStream { - STDMETHOD(Create)(UInt32 historySize, UInt32 keepAddBufferBefore, + STDMETHOD(Create)(UInt32 historySize, UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter) PURE; STDMETHOD(GetMatches)(UInt32 *distances) PURE; STDMETHOD(Skip)(UInt32 num) PURE; diff --git a/util/cbfstool/lzma/C/7zip/Compress/LZ/LZInWindow.cpp b/util/cbfstool/lzma/C/7zip/Compress/LZ/LZInWindow.cpp index 0e65c4254b..c4d331e933 100644 --- a/util/cbfstool/lzma/C/7zip/Compress/LZ/LZInWindow.cpp +++ b/util/cbfstool/lzma/C/7zip/Compress/LZ/LZInWindow.cpp @@ -62,8 +62,8 @@ void CLZInWindow::ReleaseStream() // _streamPos >= _pos + _keepSizeAfter // _posLimit = _streamPos - _keepSizeAfter; // else -// - +// + HRESULT CLZInWindow::ReadBlock() { if(_streamEndWasReached) @@ -98,7 +98,7 @@ void CLZInWindow::MoveBlock() UInt32 offset = (UInt32)(_buffer - _bufferBase) + _pos - _keepSizeBefore; // we need one additional byte, since MovePos moves on 1 byte. if (offset > 0) - offset--; + offset--; UInt32 numBytes = (UInt32)(_buffer - _bufferBase) + _streamPos - offset; memmove(_bufferBase, _bufferBase + offset, numBytes); _buffer -= offset; diff --git a/util/cbfstool/lzma/C/7zip/Compress/LZ/LZInWindow.h b/util/cbfstool/lzma/C/7zip/Compress/LZ/LZInWindow.h index 54f2cb7bba..670a570378 100644 --- a/util/cbfstool/lzma/C/7zip/Compress/LZ/LZInWindow.h +++ b/util/cbfstool/lzma/C/7zip/Compress/LZ/LZInWindow.h @@ -56,7 +56,7 @@ public: // index + limit have not to exceed _keepSizeAfter; // -2G <= index < 2G UInt32 GetMatchLen(Int32 index, UInt32 distance, UInt32 limit) const - { + { if(_streamEndWasReached) if ((_pos + index) + limit > _streamPos) limit = _streamPos - (_pos + index); diff --git a/util/cbfstool/lzma/C/7zip/Compress/LZ/StdAfx.h b/util/cbfstool/lzma/C/7zip/Compress/LZ/StdAfx.h index 3ff6d8a29f..b637fd4007 100644 --- a/util/cbfstool/lzma/C/7zip/Compress/LZ/StdAfx.h +++ b/util/cbfstool/lzma/C/7zip/Compress/LZ/StdAfx.h @@ -3,4 +3,4 @@ #ifndef __STDAFX_H #define __STDAFX_H -#endif +#endif |