/* Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source. */
STATIC VOID FillBuf(IN SCRATCH_DATA *Sd, IN UINT16 NumOfBits)
/* Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source. */
STATIC VOID FillBuf(IN SCRATCH_DATA *Sd, IN UINT16 NumOfBits)
{
  Sd->mBitBuf = (UINT32) (((UINT64)Sd->mBitBuf) << NumOfBits);
  while (NumOfBits > Sd->mBitCount) {
    Sd->mBitBuf |= (UINT32) (((UINT64)Sd->mSubBitBuf) << (NumOfBits = (UINT16) (NumOfBits - Sd->mBitCount)));
    if (Sd->mCompSize > 0) {
      Sd->mCompSize--;
      Sd->mSubBitBuf  = 0;
      Sd->mSubBitBuf  = Sd->mSrcBase[Sd->mInBuf++];
      Sd->mBitCount   = 8;
    } else {
      Sd->mSubBitBuf  = 0;
      Sd->mBitCount   = 8;
    }
  }
  Sd->mBitCount = (UINT16) (Sd->mBitCount - NumOfBits);
  Sd->mBitBuf |= Sd->mSubBitBuf >> Sd->mBitCount;
}