diff options
author | Matt Turner <mattst88@gmail.com> | 2008-11-12 23:25:26 +0000 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2008-11-12 23:25:26 +0000 |
commit | 37438ca202a9a1f4e782f1d1803686fc6b65e918 (patch) | |
tree | 7cf856979306a32f7817b528b306539cf914e93b /huffman.c | |
parent | 7a57eeccd8ded740d88aba3ea9dcb09050983dd0 (diff) |
Move static function prototypes from nbench1.h to appropriate files
git-svn-id: svn://mattst88.com/svn/cleanbench/trunk@14 0d43b9a7-5ab2-4d7b-af9d-f64450cef757
Diffstat (limited to 'huffman.c')
-rw-r--r-- | huffman.c | 51 |
1 files changed, 43 insertions, 8 deletions
@@ -3,13 +3,52 @@ #include "nmglobal.h" #include "nbench1.h" + +/************************ +** HUFFMAN COMPRESSION ** +************************/ + +/* +** DEFINES +*/ +#define EXCLUDED 32000L /* Big positive value */ + +/* +** TYPEDEFS +*/ +typedef struct { + unsigned char c; /* Byte value */ + float freq; /* Frequency */ + int parent; /* Parent node */ + int left; /* Left pointer = 0 */ + int right; /* Right pointer = 1 */ +} huff_node; + +/* +** GLOBALS +*/ +static huff_node *hufftree; /* The huffman tree */ +static long plaintextlen; /* Length of plaintext */ + +/* +** PROTOTYPES +*/ +static void create_text_line(char *dt,long nchars); +static void create_text_block(char *tb, unsigned long tblen, + unsigned short maxlinlen); +static unsigned long DoHuffIteration(char *plaintext, + char *comparray, char *decomparray, + unsigned long arraysize, unsigned long nloops, huff_node *hufftree); +static void SetCompBit(uint8_t *comparray, uint32_t bitoffset, char bitchar); +static int GetCompBit(uint8_t *comparray, uint32_t bitoffset); + /* ** Word catalog */ #define WORDCATSIZE 50 -char *wordcatarray[WORDCATSIZE] = -{ "Hello", +char *wordcatarray[WORDCATSIZE] = { /* FIXME: const? */ + "Hello", "He", "Him", "the", @@ -58,12 +97,8 @@ char *wordcatarray[WORDCATSIZE] = "used", "shown", "you", - "know" }; - - -/************************ -** HUFFMAN COMPRESSION ** -************************/ + "know" +}; /************** ** DoHuffman ** |