LLVM API Documentation

huffman.c File Reference

#include "bzlib_private.h"

Include dependency graph for huffman.c:

Go to the source code of this file.

Defines

#define WEIGHTOF(zz0)   ((zz0) & 0xffffff00)
#define DEPTHOF(zz1)   ((zz1) & 0x000000ff)
#define MYMAX(zz2, zz3)   ((zz2) > (zz3) ? (zz2) : (zz3))
#define ADDWEIGHTS(zw1, zw2)
#define UPHEAP(z)
#define DOWNHEAP(z)

Functions

void BZ2_hbMakeCodeLengths (UChar *len, Int32 *freq, Int32 alphaSize, Int32 maxLen)
void BZ2_hbAssignCodes (Int32 *code, UChar *length, Int32 minLen, Int32 maxLen, Int32 alphaSize)
void BZ2_hbCreateDecodeTables (Int32 *limit, Int32 *base, Int32 *perm, UChar *length, Int32 minLen, Int32 maxLen, Int32 alphaSize)


Define Documentation

#define ADDWEIGHTS ( zw1,
zw2   ) 

Value:

(WEIGHTOF(zw1)+WEIGHTOF(zw2)) |                    \
   (1 + MYMAX(DEPTHOF(zw1),DEPTHOF(zw2)))

Definition at line 69 of file huffman.c.

Referenced by BZ2_hbMakeCodeLengths().

#define DEPTHOF ( zz1   )     ((zz1) & 0x000000ff)

Definition at line 66 of file huffman.c.

#define DOWNHEAP (  ) 

Value:

{                                                     \
   Int32 zz, yy, tmp;                                 \
   zz = z; tmp = heap[zz];                            \
   while (True) {                                     \
      yy = zz << 1;                                   \
      if (yy > nHeap) break;                          \
      if (yy < nHeap &&                               \
          weight[heap[yy+1]] < weight[heap[yy]])      \
         yy++;                                        \
      if (weight[tmp] < weight[heap[yy]]) break;      \
      heap[zz] = heap[yy];                            \
      zz = yy;                                        \
   }                                                  \
   heap[zz] = tmp;                                    \
}

Definition at line 84 of file huffman.c.

Referenced by BZ2_hbMakeCodeLengths().

#define MYMAX ( zz2,
zz3   )     ((zz2) > (zz3) ? (zz2) : (zz3))

Definition at line 67 of file huffman.c.

#define UPHEAP (  ) 

Value:

{                                                     \
   Int32 zz, tmp;                                     \
   zz = z; tmp = heap[zz];                            \
   while (weight[tmp] < weight[heap[zz >> 1]]) {      \
      heap[zz] = heap[zz >> 1];                       \
      zz >>= 1;                                       \
   }                                                  \
   heap[zz] = tmp;                                    \
}

Definition at line 73 of file huffman.c.

Referenced by BZ2_hbMakeCodeLengths().

#define WEIGHTOF ( zz0   )     ((zz0) & 0xffffff00)

Definition at line 65 of file huffman.c.


Function Documentation

void BZ2_hbAssignCodes ( Int32 code,
UChar length,
Int32  minLen,
Int32  maxLen,
Int32  alphaSize 
)

Definition at line 175 of file huffman.c.

void BZ2_hbCreateDecodeTables ( Int32 limit,
Int32 base,
Int32 perm,
UChar length,
Int32  minLen,
Int32  maxLen,
Int32  alphaSize 
)

Definition at line 193 of file huffman.c.

References BZ_MAX_CODE_LEN.

Referenced by BZ2_decompress().

void BZ2_hbMakeCodeLengths ( UChar len,
Int32 freq,
Int32  alphaSize,
Int32  maxLen 
)

Definition at line 103 of file huffman.c.

References ADDWEIGHTS, AssertH, BZ_MAX_ALPHA_SIZE, DOWNHEAP, False, True, and UPHEAP.