beautypg.com

Intel Extensible Firmware Interface User Manual

Page 985

background image

Compression Source Code

Version 1.10

12/01/02

H-21

for (i = 0; i < NP; i++) {
mPFreq[i] = 0;
}
}


STATIC
VOID
Output (
IN UINT32 c,
IN UINT32 p
)
/*++

Routine Description:

Outputs an Original Character or a Pointer

Arguments:

c - The original character or the ’String Length’ element of a Pointer
p - The ’Position’ field of a Pointer

Returns: (VOID)

--*/
{
STATIC UINT32 CPos;

if ((mOutputMask >>= 1) == 0) {
mOutputMask = 1U << (UINT8_BIT - 1);
if (mOutputPos >= mBufSiz - 3 * UINT8_BIT) {
SendBlock();
mOutputPos = 0;
}
CPos = mOutputPos++;
mBuf[CPos] = 0;
}
mBuf[mOutputPos++] = (UINT8) c;
mCFreq[c]++;
if (c >= (1U << UINT8_BIT)) {
mBuf[CPos] |= mOutputMask;
mBuf[mOutputPos++] = (UINT8)(p >> UINT8_BIT);
mBuf[mOutputPos++] = (UINT8) p;
c = 0;
while (p) {
p >>= 1;
c++;
}
mPFreq[c]++;
}
}