#ifndef _GLOBALS_H #define _GLOBALS_H // // // author: Owen Astrachan // // used for implementing data compression based on Huffman Codes #include "bitops.h" const int BITS_PER_INT = 32; // # bits per int // // standard binary-tree node storing int // note that in Huffman tree only leaf nodes store // values, but using a union wouldn't save space // struct HuffNode { int info; HuffNode * left; HuffNode * right; HuffNode(int val, HuffNode * lchild=0, HuffNode * rchild=0) : info(val), left(lchild), right(rchild) {} }; // // ALPH_SIZE is inherited from bitops.h // the huffman alphabet includes a character // for pseudo-EOF char, the index of this character // is given by EOF_INDEX (and is normally as // shown since it's the last character) // const int HUFF_ALPH_SIZE = ALPH_SIZE+1; const int EOF_INDEX = ALPH_SIZE; #endif