MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / DecodeP

Function DecodeP

BaseTools/Source/C/Common/Decompress.c:293–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291}
292
293STATIC
294UINT32
295DecodeP (
296 IN SCRATCH_DATA *Sd
297 )
298/*++
299
300Routine Description:
301
302 Decodes a position value.
303
304Arguments:
305
306 Sd - the global scratch data
307
308Returns:
309
310 The position value decoded.
311
312--*/
313{
314 UINT16 Val;
315 UINT32 Mask;
316 UINT32 Pos;
317
318 Val = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)];
319
320 if (Val >= MAXNP) {
321 Mask = 1U << (BITBUFSIZ - 1 - 8);
322
323 do {
324
325 if (Sd->mBitBuf & Mask) {
326 Val = Sd->mRight[Val];
327 } else {
328 Val = Sd->mLeft[Val];
329 }
330
331 Mask >>= 1;
332 } while (Val >= MAXNP);
333 }
334 //
335 // Advance what we have read
336 //
337 FillBuf (Sd, Sd->mPTLen[Val]);
338
339 Pos = Val;
340 if (Val > 1) {
341 Pos = (UINT32) ((1U << (Val - 1)) + GetBits (Sd, (UINT16) (Val - 1)));
342 }
343
344 return Pos;
345}
346
347STATIC
348UINT16

Callers 2

DecodeFunction · 0.70
TianoCompress.cFile · 0.50

Calls 2

FillBufFunction · 0.70
GetBitsFunction · 0.70

Tested by

no test coverage detected