/* Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent NumOfBits of bits from source. Returns NumOfBits of bits that are popped out. */
UINT32 GetBits(IN SCRATCH_DATA *Sd, IN UINT16 NumOfBits)
/* Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent NumOfBits of bits from source. Returns NumOfBits of bits that are popped out. */
UINT32 GetBits(IN SCRATCH_DATA *Sd, IN UINT16 NumOfBits)
{
  UINT32  OutBits;
  OutBits = (UINT32)(Sd->mBitBuf >> (BITBUFSIZ - NumOfBits));
  FillBuf (Sd, NumOfBits);
  return OutBits;
}