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

Function ReadCLen

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

Source from the content-addressed store, hash-verified

431}
432
433STATIC
434VOID
435ReadCLen (
436 SCRATCH_DATA *Sd
437 )
438/*++
439
440Routine Description:
441
442 Reads code lengths for Char&Len Set.
443
444Arguments:
445
446 Sd - the global scratch data
447
448Returns: (VOID)
449
450--*/
451{
452 UINT16 Number;
453 UINT16 CharC;
454 UINT16 Index;
455 UINT32 Mask;
456
457 Number = (UINT16) GetBits (Sd, CBIT);
458
459 if (Number == 0) {
460 CharC = (UINT16) GetBits (Sd, CBIT);
461
462 for (Index = 0; Index < NC; Index++) {
463 Sd->mCLen[Index] = 0;
464 }
465
466 for (Index = 0; Index < 4096; Index++) {
467 Sd->mCTable[Index] = CharC;
468 }
469
470 return ;
471 }
472
473 Index = 0;
474 while (Index < Number) {
475
476 CharC = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)];
477 if (CharC >= NT) {
478 Mask = 1U << (BITBUFSIZ - 1 - 8);
479
480 do {
481
482 if (Mask & Sd->mBitBuf) {
483 CharC = Sd->mRight[CharC];
484 } else {
485 CharC = Sd->mLeft[CharC];
486 }
487
488 Mask >>= 1;
489
490 } while (CharC >= NT);

Callers 1

DecodeCFunction · 0.70

Calls 3

GetBitsFunction · 0.70
FillBufFunction · 0.70
MakeTableFunction · 0.70

Tested by

no test coverage detected