Logo Search packages:      
Sourcecode: cbmconvert version File versions  Download package

static byte_t Huffin ( void   )  [static]

Fetch a Huffman code and convert it to what it represents

Returns:
the converted code

Definition at line 234 of file unarc.c.

References GetBit(), hc, hcount, hl, hv, and Status.

Referenced by UnPack().

{
  long hcode = 0;
  long mask  = 1;
  int  size  = 1;
  int  now;

  now = hcount;       /* First non=zero Huffman code */

  do {
    if (GetBit ())
      hcode |= mask;

    while( hl[now] == size) {

      if (hc[now] == hcode)
      return hv[now];

      if (--now < 0) {         /* Error in decode table */
      Status = EOF;
      return 0;
      }
    }
    size++;
    mask = mask << 1;
  } while (size < 24);

  Status = EOF;                /* Error. Huffman code too big */
  return 0;
}


Generated by  Doxygen 1.6.0   Back to index