MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / MakeTable

Function MakeTable

BaseTools/Source/C/Common/Decompress.c:149–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149STATIC
150UINT16
151MakeTable (
152 IN SCRATCH_DATA *Sd,
153 IN UINT16 NumOfChar,
154 IN UINT8 *BitLen,
155 IN UINT16 TableBits,
156 OUT UINT16 *Table
157 )
158/*++
159
160Routine Description:
161
162 Creates Huffman Code mapping table according to code length array.
163
164Arguments:
165
166 Sd - The global scratch data
167 NumOfChar - Number of symbols in the symbol set
168 BitLen - Code length array
169 TableBits - The width of the mapping table
170 Table - The table
171
172Returns:
173
174 0 - OK.
175 BAD_TABLE - The table is corrupted.
176
177--*/
178{
179 UINT16 Count[17];
180 UINT16 Weight[17];
181 UINT16 Start[18];
182 UINT16 *Pointer;
183 UINT16 Index3;
184 UINT16 Index;
185 UINT16 Len;
186 UINT16 Char;
187 UINT16 JuBits;
188 UINT16 Avail;
189 UINT16 NextCode;
190 UINT16 Mask;
191 UINT16 MaxTableLength;
192
193 for (Index = 1; Index <= 16; Index++) {
194 Count[Index] = 0;
195 }
196
197 for (Index = 0; Index < NumOfChar; Index++) {
198 if (BitLen[Index] > 16) {
199 return (UINT16) BAD_TABLE;
200 }
201 Count[BitLen[Index]]++;
202 }
203
204 Start[1] = 0;
205
206 for (Index = 1; Index <= 16; Index++) {

Callers 2

ReadPTLenFunction · 0.70
ReadCLenFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected