1baa3858d3f5d128a5c8466b700098109edcad5f2repo sync// Base.java
2baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
3baa3858d3f5d128a5c8466b700098109edcad5f2repo syncpackage SevenZip.Compression.LZMA;
4baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
5baa3858d3f5d128a5c8466b700098109edcad5f2repo syncpublic class Base
6baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{
7baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final int kNumRepDistances = 4;
8baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final int kNumStates = 12;
9baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
10baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final int StateInit()
11baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	{
12baa3858d3f5d128a5c8466b700098109edcad5f2repo sync		return 0;
13baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	}
14baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
15baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final int StateUpdateChar(int index)
16baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	{
17baa3858d3f5d128a5c8466b700098109edcad5f2repo sync		if (index < 4)
18baa3858d3f5d128a5c8466b700098109edcad5f2repo sync			return 0;
19baa3858d3f5d128a5c8466b700098109edcad5f2repo sync		if (index < 10)
20baa3858d3f5d128a5c8466b700098109edcad5f2repo sync			return index - 3;
21baa3858d3f5d128a5c8466b700098109edcad5f2repo sync		return index - 6;
22baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	}
23baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
24baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final int StateUpdateMatch(int index)
25baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	{
26baa3858d3f5d128a5c8466b700098109edcad5f2repo sync		return (index < 7 ? 7 : 10);
27baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	}
28baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
29baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final int StateUpdateRep(int index)
30baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	{
31baa3858d3f5d128a5c8466b700098109edcad5f2repo sync		return (index < 7 ? 8 : 11);
32baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	}
33baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
34baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final int StateUpdateShortRep(int index)
35baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	{
36baa3858d3f5d128a5c8466b700098109edcad5f2repo sync		return (index < 7 ? 9 : 11);
37baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	}
38baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
39baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final boolean StateIsCharState(int index)
40baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	{
41baa3858d3f5d128a5c8466b700098109edcad5f2repo sync		return index < 7;
42baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	}
43baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
44baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final int kNumPosSlotBits = 6;
45baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final int kDicLogSizeMin = 0;
46baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	// public static final int kDicLogSizeMax = 28;
47baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	// public static final int kDistTableSizeMax = kDicLogSizeMax * 2;
48baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
49baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final int kNumLenToPosStatesBits = 2; // it's for speed optimization
50baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final int kNumLenToPosStates = 1 << kNumLenToPosStatesBits;
51baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
52baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final int kMatchMinLen = 2;
53baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
54baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final int GetLenToPosState(int len)
55baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	{
56baa3858d3f5d128a5c8466b700098109edcad5f2repo sync		len -= kMatchMinLen;
57baa3858d3f5d128a5c8466b700098109edcad5f2repo sync		if (len < kNumLenToPosStates)
58baa3858d3f5d128a5c8466b700098109edcad5f2repo sync			return len;
59baa3858d3f5d128a5c8466b700098109edcad5f2repo sync		return (int)(kNumLenToPosStates - 1);
60baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	}
61baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
62baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final int kNumAlignBits = 4;
63baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final int kAlignTableSize = 1 << kNumAlignBits;
64baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final int kAlignMask = (kAlignTableSize - 1);
65baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
66baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final int kStartPosModelIndex = 4;
67baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final int kEndPosModelIndex = 14;
68baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final int kNumPosModels = kEndPosModelIndex - kStartPosModelIndex;
69baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
70baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final  int kNumFullDistances = 1 << (kEndPosModelIndex / 2);
71baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
72baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final  int kNumLitPosStatesBitsEncodingMax = 4;
73baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final  int kNumLitContextBitsMax = 8;
74baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
75baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final  int kNumPosStatesBitsMax = 4;
76baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final  int kNumPosStatesMax = (1 << kNumPosStatesBitsMax);
77baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final  int kNumPosStatesBitsEncodingMax = 4;
78baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final  int kNumPosStatesEncodingMax = (1 << kNumPosStatesBitsEncodingMax);
79baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
80baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final  int kNumLowLenBits = 3;
81baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final  int kNumMidLenBits = 3;
82baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final  int kNumHighLenBits = 8;
83baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final  int kNumLowLenSymbols = 1 << kNumLowLenBits;
84baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final  int kNumMidLenSymbols = 1 << kNumMidLenBits;
85baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final  int kNumLenSymbols = kNumLowLenSymbols + kNumMidLenSymbols +
86baa3858d3f5d128a5c8466b700098109edcad5f2repo sync			(1 << kNumHighLenBits);
87baa3858d3f5d128a5c8466b700098109edcad5f2repo sync	public static final  int kMatchMaxLen = kMatchMinLen + kNumLenSymbols - 1;
88baa3858d3f5d128a5c8466b700098109edcad5f2repo sync}
89