convert line ends
[canaan.git] / prj / tech / libsrc / dstruct / huffde.c
blob41f9db64b41de29059167db06fd762f8be61cb55
1 // HUFFDE.C Huffman decompression routines
2 // Rex E. Bradford
4 /*
5 * $Header: r:/prj/lib/src/dstruct/rcs/huffde.c 1.1 1994/08/22 17:13:01 rex Exp $
6 * $Log: huffde.c $
7 * Revision 1.1 1994/08/22 17:13:01 rex
8 * Initial revision
12 #include <string.h>
14 #include <dbg.h>
15 #include <huff.h>
17 // ----------------------------------------------------------------
18 // DECOMPRESS HUFFMAN MULTI-TABLES
19 // ----------------------------------------------------------------
21 // HuffExpandFlashTables() compresses huffman flash-decoder tables.
23 void HuffExpandFlashTables(uchar *pFlashTab, ulong lenTab, ulong *pc,
24 int tokSize)
26 uchar *pft;
27 ulong token,runCount;
28 int runShift;
30 // Setup
32 pft = pFlashTab;
33 runShift = tokSize * 8;
35 // While still inside dest table, keep going
37 while (pft < (pFlashTab + lenTab))
40 // Get next token, extract run count
42 token = *pc++;
43 runCount = token >> runShift;
45 // Copy that many times into dest
47 while (runCount-- != 0)
49 memcpy(pft, &token, tokSize);
50 pft += tokSize;