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

Function DecodeC

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

Source from the content-addressed store, hash-verified

527}
528
529STATIC
530UINT16
531DecodeC (
532 SCRATCH_DATA *Sd
533 )
534/*++
535
536Routine Description:
537
538 Decode a character/length value.
539
540Arguments:
541
542 Sd - The global scratch data.
543
544Returns:
545
546 The value decoded.
547
548--*/
549{
550 UINT16 Index2;
551 UINT32 Mask;
552
553 if (Sd->mBlockSize == 0) {
554 //
555 // Starting a new block
556 //
557 Sd->mBlockSize = (UINT16) GetBits (Sd, 16);
558 Sd->mBadTableFlag = ReadPTLen (Sd, NT, TBIT, 3);
559 if (Sd->mBadTableFlag != 0) {
560 return 0;
561 }
562
563 ReadCLen (Sd);
564
565 Sd->mBadTableFlag = ReadPTLen (Sd, MAXNP, mPbit, (UINT16) (-1));
566 if (Sd->mBadTableFlag != 0) {
567 return 0;
568 }
569 }
570
571 Sd->mBlockSize--;
572 Index2 = Sd->mCTable[Sd->mBitBuf >> (BITBUFSIZ - 12)];
573
574 if (Index2 >= NC) {
575 Mask = 1U << (BITBUFSIZ - 1 - 12);
576
577 do {
578 if (Sd->mBitBuf & Mask) {
579 Index2 = Sd->mRight[Index2];
580 } else {
581 Index2 = Sd->mLeft[Index2];
582 }
583
584 Mask >>= 1;
585 } while (Index2 >= NC);
586 }

Callers 2

DecodeFunction · 0.70
TianoCompress.cFile · 0.50

Calls 4

GetBitsFunction · 0.70
ReadPTLenFunction · 0.70
ReadCLenFunction · 0.70
FillBufFunction · 0.70

Tested by

no test coverage detected