MCPcopy Create free account
hub / github.com/hoothin/UserScripts / fixedtables

Function fixedtables

Picviewer CE+/dist.user.js:8707–8738  ·  view source on GitHub ↗
(state)

Source from the content-addressed store, hash-verified

8705var lenfix, distfix; // We have no pointers in JS, so keep tables separate
8706
8707function fixedtables(state) {
8708 /* build fixed huffman tables if first call (may not be thread safe) */
8709 if (virgin) {
8710 var sym;
8711
8712 lenfix = new utils.Buf32(512);
8713 distfix = new utils.Buf32(32);
8714
8715 /* literal/length table */
8716 sym = 0;
8717 while (sym < 144) { state.lens[sym++] = 8; }
8718 while (sym < 256) { state.lens[sym++] = 9; }
8719 while (sym < 280) { state.lens[sym++] = 7; }
8720 while (sym < 288) { state.lens[sym++] = 8; }
8721
8722 inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });
8723
8724 /* distance table */
8725 sym = 0;
8726 while (sym < 32) { state.lens[sym++] = 5; }
8727
8728 inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });
8729
8730 /* do this just once */
8731 virgin = false;
8732 }
8733
8734 state.lencode = lenfix;
8735 state.lenbits = 9;
8736 state.distcode = distfix;
8737 state.distbits = 5;
8738}
8739
8740
8741/*

Callers 1

inflateFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected