MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / LongLZ

Method LongLZ

Libraries/unrar/unpack15.cpp:229–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227
228
229void Unpack::LongLZ()
230{
231 unsigned int Length;
232 unsigned int Distance;
233 unsigned int DistancePlace,NewDistancePlace;
234 unsigned int OldAvr2,OldAvr3;
235
236 NumHuf=0;
237 Nlzb+=16;
238 if (Nlzb > 0xff)
239 {
240 Nlzb=0x90;
241 Nhfb >>= 1;
242 }
243 OldAvr2=AvrLn2;
244
245 unsigned int BitField=Inp.fgetbits();
246 if (AvrLn2 >= 122)
247 Length=DecodeNum(BitField,STARTL2,DecL2,PosL2);
248 else
249 if (AvrLn2 >= 64)
250 Length=DecodeNum(BitField,STARTL1,DecL1,PosL1);
251 else
252 if (BitField < 0x100)
253 {
254 Length=BitField;
255 Inp.faddbits(16);
256 }
257 else
258 {
259 for (Length=0;((BitField<<Length)&0x8000)==0;Length++)
260 ;
261 Inp.faddbits(Length+1);
262 }
263
264 AvrLn2 += Length;
265 AvrLn2 -= AvrLn2 >> 5;
266
267 BitField=Inp.fgetbits();
268 if (AvrPlcB > 0x28ff)
269 DistancePlace=DecodeNum(BitField,STARTHF2,DecHf2,PosHf2);
270 else
271 if (AvrPlcB > 0x6ff)
272 DistancePlace=DecodeNum(BitField,STARTHF1,DecHf1,PosHf1);
273 else
274 DistancePlace=DecodeNum(BitField,STARTHF0,DecHf0,PosHf0);
275
276 AvrPlcB += DistancePlace;
277 AvrPlcB -= AvrPlcB >> 8;
278 while (1)
279 {
280 Distance = ChSetB[DistancePlace & 0xff];
281 NewDistancePlace = NToPlB[Distance++ & 0xff]++;
282 if (!(Distance & 0xff))
283 CorrHuff(ChSetB,NToPlB);
284 else
285 break;
286 }

Callers

nothing calls this directly

Calls 2

fgetbitsMethod · 0.80
faddbitsMethod · 0.80

Tested by

no test coverage detected