Intel Extensible Firmware Interface User Manual

Page 987

Advertising
background image

Compression Source Code

Version 1.10

12/01/02

H-23

Routine Description:

Outputs rightmost n bits of x

Argments:

n - the rightmost n bits of the data is used
x - the data

Returns: (VOID)

--*/
{
UINT8 Temp;

if (n < mBitCount) {
mSubBitBuf |= x << (mBitCount -= n);
} else {

Temp = (UINT8)(mSubBitBuf | (x >> (n -= mBitCount)));
if (mDst < mDstUpperLimit) {
*mDst++ = Temp;
}
mCompSize++;

if (n < UINT8_BIT) {
mSubBitBuf = x << (mBitCount = UINT8_BIT - n);
} else {

Temp = (UINT8)(x >> (n - UINT8_BIT));
if (mDst < mDstUpperLimit) {
*mDst++ = Temp;
}
mCompSize++;

mSubBitBuf = x << (mBitCount = 2 * UINT8_BIT - n);
}
}
}

STATIC
INT32
FreadCrc (
OUT UINT8 *p,
IN INT32 n
)
/*++

Routine Description:

Read in source data

Arguments:

p - the buffer to hold the data
n - number of bytes to read

Advertising