MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / makefixed

Function makefixed

ZLib/inflate.c:325–362  ·  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

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

Callers

nothing calls this directly

Calls 1

fixedtablesFunction · 0.70

Tested by

no test coverage detected