BCM WL 6.30.102.9 (r366174)
[tomato.git] / release / src-rt / linux / linux-2.6 / scripts / squashfs / lzma / C / 7zip / Compress / LZMA / LZMA.h
blobd53296ee709a5e8fb276ea9c80c01383d2b47fad
1 // LZMA.h
3 #ifndef __LZMA_H
4 #define __LZMA_H
6 namespace NCompress {
7 namespace NLZMA {
9 const UInt32 kNumRepDistances = 4;
11 const int kNumStates = 12;
13 const Byte kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5};
14 const Byte kMatchNextStates[kNumStates] = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10};
15 const Byte kRepNextStates[kNumStates] = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11};
16 const Byte kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11};
18 class CState
20 public:
21 Byte Index;
22 void Init() { Index = 0; }
23 void UpdateChar() { Index = kLiteralNextStates[Index]; }
24 void UpdateMatch() { Index = kMatchNextStates[Index]; }
25 void UpdateRep() { Index = kRepNextStates[Index]; }
26 void UpdateShortRep() { Index = kShortRepNextStates[Index]; }
27 bool IsCharState() const { return Index < 7; }
30 const int kNumPosSlotBits = 6;
31 const int kDicLogSizeMin = 0;
32 const int kDicLogSizeMax = 32;
33 const int kDistTableSizeMax = kDicLogSizeMax * 2;
35 const UInt32 kNumLenToPosStates = 4;
37 inline UInt32 GetLenToPosState(UInt32 len)
39 len -= 2;
40 if (len < kNumLenToPosStates)
41 return len;
42 return kNumLenToPosStates - 1;
45 namespace NLength {
47 const int kNumPosStatesBitsMax = 4;
48 const UInt32 kNumPosStatesMax = (1 << kNumPosStatesBitsMax);
50 const int kNumPosStatesBitsEncodingMax = 4;
51 const UInt32 kNumPosStatesEncodingMax = (1 << kNumPosStatesBitsEncodingMax);
53 const int kNumLowBits = 3;
54 const int kNumMidBits = 3;
55 const int kNumHighBits = 8;
56 const UInt32 kNumLowSymbols = 1 << kNumLowBits;
57 const UInt32 kNumMidSymbols = 1 << kNumMidBits;
58 const UInt32 kNumSymbolsTotal = kNumLowSymbols + kNumMidSymbols + (1 << kNumHighBits);
62 const UInt32 kMatchMinLen = 2;
63 const UInt32 kMatchMaxLen = kMatchMinLen + NLength::kNumSymbolsTotal - 1;
65 const int kNumAlignBits = 4;
66 const UInt32 kAlignTableSize = 1 << kNumAlignBits;
67 const UInt32 kAlignMask = (kAlignTableSize - 1);
69 const UInt32 kStartPosModelIndex = 4;
70 const UInt32 kEndPosModelIndex = 14;
71 const UInt32 kNumPosModels = kEndPosModelIndex - kStartPosModelIndex;
73 const UInt32 kNumFullDistances = 1 << (kEndPosModelIndex / 2);
75 const int kNumLitPosStatesBitsEncodingMax = 4;
76 const int kNumLitContextBitsMax = 8;
78 const int kNumMoveBits = 5;
82 #endif