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

Function deflatePrime

extern/zlib/src/deflate.c:723–749  ·  view source on GitHub ↗

========================================================================= */

Source from the content-addressed store, hash-verified

721
722/* ========================================================================= */
723int ZEXPORT deflatePrime(z_streamp strm, int bits, int value) {
724 deflate_state *s;
725 int put;
726
727 if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
728 s = strm->state;
729#ifdef LIT_MEM
730 if (bits < 0 || bits > 16 ||
731 (uchf *)s->d_buf < s->pending_out + ((Buf_size + 7) >> 3))
732 return Z_BUF_ERROR;
733#else
734 if (bits < 0 || bits > 16 ||
735 s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3))
736 return Z_BUF_ERROR;
737#endif
738 do {
739 put = Buf_size - s->bi_valid;
740 if (put > bits)
741 put = bits;
742 s->bi_buf |= (ush)((value & ((1 << put) - 1)) << s->bi_valid);
743 s->bi_valid += put;
744 _tr_flush_bits(s);
745 value >>= put;
746 bits -= put;
747 } while (bits);
748 return Z_OK;
749}
750
751/* ========================================================================= */
752int ZEXPORT deflateParams(z_streamp strm, int level, int strategy) {

Callers

nothing calls this directly

Calls 2

deflateStateCheckFunction · 0.85
_tr_flush_bitsFunction · 0.85

Tested by

no test coverage detected