BCM WL 6.30.102.9 (r366174)
[tomato.git] / release / src-rt / linux / linux-2.6 / scripts / squashfs / lzma / CS / 7zip / Compress / LZMA / LzmaBase.cs
blobacea8ebcb154226f249383e272195700496530f8
1 // LzmaBase.cs
3 namespace SevenZip.Compression.LZMA
5 internal abstract class Base
7 public const uint kNumRepDistances = 4;
8 public const uint kNumStates = 12;
10 // static byte []kLiteralNextStates = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5};
11 // static byte []kMatchNextStates = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10};
12 // static byte []kRepNextStates = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11};
13 // static byte []kShortRepNextStates = {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11};
15 public struct State
17 public uint Index;
18 public void Init() { Index = 0; }
19 public void UpdateChar()
21 if (Index < 4) Index = 0;
22 else if (Index < 10) Index -= 3;
23 else Index -= 6;
25 public void UpdateMatch() { Index = (uint)(Index < 7 ? 7 : 10); }
26 public void UpdateRep() { Index = (uint)(Index < 7 ? 8 : 11); }
27 public void UpdateShortRep() { Index = (uint)(Index < 7 ? 9 : 11); }
28 public bool IsCharState() { return Index < 7; }
31 public const int kNumPosSlotBits = 6;
32 public const int kDicLogSizeMin = 0;
33 public const int kDicLogSizeMax = 28;
34 public const uint kDistTableSizeMax = kDicLogSizeMax * 2;
36 public const int kNumLenToPosStatesBits = 2; // it's for speed optimization
37 public const uint kNumLenToPosStates = 1 << kNumLenToPosStatesBits;
39 public const uint kMatchMinLen = 2;
41 public static uint GetLenToPosState(uint len)
43 len -= kMatchMinLen;
44 if (len < kNumLenToPosStates)
45 return len;
46 return (uint)(kNumLenToPosStates - 1);
49 public const int kNumAlignBits = 4;
50 public const uint kAlignTableSize = 1 << kNumAlignBits;
51 public const uint kAlignMask = (kAlignTableSize - 1);
53 public const uint kStartPosModelIndex = 4;
54 public const uint kEndPosModelIndex = 14;
55 public const uint kNumPosModels = kEndPosModelIndex - kStartPosModelIndex;
57 public const uint kNumFullDistances = 1 << ((int)kEndPosModelIndex / 2);
59 public const uint kNumLitPosStatesBitsEncodingMax = 4;
60 public const uint kNumLitContextBitsMax = 8;
62 public const int kNumPosStatesBitsMax = 4;
63 public const uint kNumPosStatesMax = (1 << kNumPosStatesBitsMax);
64 public const int kNumPosStatesBitsEncodingMax = 4;
65 public const uint kNumPosStatesEncodingMax = (1 << kNumPosStatesBitsEncodingMax);
67 public const int kNumLowLenBits = 3;
68 public const int kNumMidLenBits = 3;
69 public const int kNumHighLenBits = 8;
70 public const uint kNumLowLenSymbols = 1 << kNumLowLenBits;
71 public const uint kNumMidLenSymbols = 1 << kNumMidLenBits;
72 public const uint kNumLenSymbols = kNumLowLenSymbols + kNumMidLenSymbols +
73 (1 << kNumHighLenBits);
74 public const uint kMatchMaxLen = kMatchMinLen + kNumLenSymbols - 1;