diff options
author | root <root@lamia.panaceas.james.local> | 2015-12-19 14:18:43 +0000 |
---|---|---|
committer | root <root@lamia.panaceas.james.local> | 2015-12-19 14:18:43 +0000 |
commit | 71478fd62d8483483abb34609cdabb7f9cbadfd6 (patch) | |
tree | 37b8eaba1ffe2d5f775227911eb0ed6fdc3c9553 /hostTools/lzma/compress/BinTreeMFMain.h | |
parent | 1a2238d1bddc823df06f67312d96ccf9de2893cc (diff) | |
download | bootloader-71478fd62d8483483abb34609cdabb7f9cbadfd6.tar.gz bootloader-71478fd62d8483483abb34609cdabb7f9cbadfd6.tar.bz2 bootloader-71478fd62d8483483abb34609cdabb7f9cbadfd6.zip |
Add hostTools from https://github.com/Noltari/cfe_bcm63xx
Diffstat (limited to 'hostTools/lzma/compress/BinTreeMFMain.h')
-rw-r--r-- | hostTools/lzma/compress/BinTreeMFMain.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/hostTools/lzma/compress/BinTreeMFMain.h b/hostTools/lzma/compress/BinTreeMFMain.h new file mode 100644 index 0000000..5438093 --- /dev/null +++ b/hostTools/lzma/compress/BinTreeMFMain.h @@ -0,0 +1,30 @@ +#include "BinTreeMain.h" + +namespace BT_NAMESPACE { + +HRESULT CMatchFinderBinTree::Create(UINT32 aSizeHistory, + UINT32 aKeepAddBufferBefore, UINT32 aMatchMaxLen, + UINT32 aKeepAddBufferAfter) +{ + const UINT32 kAlignMask = (1 << 16) - 1; + UINT32 aWindowReservSize = aSizeHistory / 2; + aWindowReservSize += kAlignMask; + aWindowReservSize &= ~(kAlignMask); + + const int kMinDictSize = (1 << 19); + if (aWindowReservSize < kMinDictSize) + aWindowReservSize = kMinDictSize; + aWindowReservSize += 256; + + try + { + return CInTree::Create(aSizeHistory, aKeepAddBufferBefore, aMatchMaxLen, + aKeepAddBufferAfter, aWindowReservSize); + } + catch(...) + { + return E_OUTOFMEMORY; + } +} + +} |