MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / makefixed

Function makefixed

extern/zlib/src/inflate.c:314–351  ·  view source on GitHub ↗

Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also defines BUILDFIXED, so the tables are built on the fly. makefixed() writes those tables to stdout, which would be piped to inffixed.h. A small program can simply call makefixed to do this: void makefixed(void); int main(void) { makefixed(); return 0; } Then that can be linke

Source from the content-addressed store, hash-verified

312 a.out > inffixed.h
313 */
314void makefixed(void)
315{
316 unsigned low, size;
317 struct inflate_state state;
318
319 fixedtables(&state);
320 puts(" /* inffixed.h -- table for decoding fixed codes");
321 puts(" * Generated automatically by makefixed().");
322 puts(" */");
323 puts("");
324 puts(" /* WARNING: this file should *not* be used by applications.");
325 puts(" It is part of the implementation of this library and is");
326 puts(" subject to change. Applications should only use zlib.h.");
327 puts(" */");
328 puts("");
329 size = 1U << 9;
330 printf(" static const code lenfix[%u] = {", size);
331 low = 0;
332 for (;;) {
333 if ((low % 7) == 0) printf("\n ");
334 printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op,
335 state.lencode[low].bits, state.lencode[low].val);
336 if (++low == size) break;
337 putchar(',');
338 }
339 puts("\n };");
340 size = 1U << 5;
341 printf("\n static const code distfix[%u] = {", size);
342 low = 0;
343 for (;;) {
344 if ((low % 6) == 0) printf("\n ");
345 printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits,
346 state.distcode[low].val);
347 if (++low == size) break;
348 putchar(',');
349 }
350 puts("\n };");
351}
352#endif /* MAKEFIXED */
353
354/*

Callers

nothing calls this directly

Calls 1

fixedtablesFunction · 0.70

Tested by

no test coverage detected