/src/c-blosc2/internal-complibs/zlib-ng-2.0.7/deflate_p.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* deflate_p.h -- Private inline functions and macros shared with more than |
2 | | * one deflate method |
3 | | * |
4 | | * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler |
5 | | * For conditions of distribution and use, see copyright notice in zlib.h |
6 | | * |
7 | | */ |
8 | | |
9 | | #ifndef DEFLATE_P_H |
10 | | #define DEFLATE_P_H |
11 | | |
12 | | /* Forward declare common non-inlined functions declared in deflate.c */ |
13 | | |
14 | | #ifdef ZLIB_DEBUG |
15 | | void check_match(deflate_state *s, Pos start, Pos match, int length); |
16 | | #else |
17 | | #define check_match(s, start, match, length) |
18 | | #endif |
19 | | void flush_pending(PREFIX3(stream) *strm); |
20 | | |
21 | | /* =========================================================================== |
22 | | * Save the match info and tally the frequency counts. Return true if |
23 | | * the current block must be flushed. |
24 | | */ |
25 | | |
26 | | extern const unsigned char Z_INTERNAL zng_length_code[]; |
27 | | extern const unsigned char Z_INTERNAL zng_dist_code[]; |
28 | | |
29 | 51.1M | static inline int zng_tr_tally_lit(deflate_state *s, unsigned char c) { |
30 | | /* c is the unmatched char */ |
31 | 51.1M | s->sym_buf[s->sym_next++] = 0; |
32 | 51.1M | s->sym_buf[s->sym_next++] = 0; |
33 | 51.1M | s->sym_buf[s->sym_next++] = c; |
34 | 51.1M | s->dyn_ltree[c].Freq++; |
35 | 51.1M | Tracevv((stderr, "%c", c)); |
36 | 51.1M | Assert(c <= (MAX_MATCH-MIN_MATCH), "zng_tr_tally: bad literal"); |
37 | 51.1M | return (s->sym_next == s->sym_end); |
38 | 51.1M | } Unexecuted instantiation: deflate.c:zng_tr_tally_lit deflate_fast.c:zng_tr_tally_lit Line | Count | Source | 29 | 16.8M | static inline int zng_tr_tally_lit(deflate_state *s, unsigned char c) { | 30 | | /* c is the unmatched char */ | 31 | 16.8M | s->sym_buf[s->sym_next++] = 0; | 32 | 16.8M | s->sym_buf[s->sym_next++] = 0; | 33 | 16.8M | s->sym_buf[s->sym_next++] = c; | 34 | 16.8M | s->dyn_ltree[c].Freq++; | 35 | 16.8M | Tracevv((stderr, "%c", c)); | 36 | 16.8M | Assert(c <= (MAX_MATCH-MIN_MATCH), "zng_tr_tally: bad literal"); | 37 | 16.8M | return (s->sym_next == s->sym_end); | 38 | 16.8M | } |
deflate_medium.c:zng_tr_tally_lit Line | Count | Source | 29 | 12.7M | static inline int zng_tr_tally_lit(deflate_state *s, unsigned char c) { | 30 | | /* c is the unmatched char */ | 31 | 12.7M | s->sym_buf[s->sym_next++] = 0; | 32 | 12.7M | s->sym_buf[s->sym_next++] = 0; | 33 | 12.7M | s->sym_buf[s->sym_next++] = c; | 34 | 12.7M | s->dyn_ltree[c].Freq++; | 35 | 12.7M | Tracevv((stderr, "%c", c)); | 36 | 12.7M | Assert(c <= (MAX_MATCH-MIN_MATCH), "zng_tr_tally: bad literal"); | 37 | 12.7M | return (s->sym_next == s->sym_end); | 38 | 12.7M | } |
Unexecuted instantiation: deflate_quick.c:zng_tr_tally_lit deflate_slow.c:zng_tr_tally_lit Line | Count | Source | 29 | 21.5M | static inline int zng_tr_tally_lit(deflate_state *s, unsigned char c) { | 30 | | /* c is the unmatched char */ | 31 | 21.5M | s->sym_buf[s->sym_next++] = 0; | 32 | 21.5M | s->sym_buf[s->sym_next++] = 0; | 33 | 21.5M | s->sym_buf[s->sym_next++] = c; | 34 | 21.5M | s->dyn_ltree[c].Freq++; | 35 | 21.5M | Tracevv((stderr, "%c", c)); | 36 | 21.5M | Assert(c <= (MAX_MATCH-MIN_MATCH), "zng_tr_tally: bad literal"); | 37 | 21.5M | return (s->sym_next == s->sym_end); | 38 | 21.5M | } |
Unexecuted instantiation: functable.c:zng_tr_tally_lit |
39 | | |
40 | 1.20M | static inline int zng_tr_tally_dist(deflate_state *s, uint32_t dist, uint32_t len) { |
41 | | /* dist: distance of matched string */ |
42 | | /* len: match length-MIN_MATCH */ |
43 | 1.20M | s->sym_buf[s->sym_next++] = (uint8_t)(dist); |
44 | 1.20M | s->sym_buf[s->sym_next++] = (uint8_t)(dist >> 8); |
45 | 1.20M | s->sym_buf[s->sym_next++] = (uint8_t)len; |
46 | 1.20M | s->matches++; |
47 | 1.20M | dist--; |
48 | 1.20M | Assert(dist < MAX_DIST(s) && (uint16_t)d_code(dist) < (uint16_t)D_CODES, |
49 | 1.20M | "zng_tr_tally: bad match"); |
50 | | |
51 | 1.20M | s->dyn_ltree[zng_length_code[len]+LITERALS+1].Freq++; |
52 | 1.20M | s->dyn_dtree[d_code(dist)].Freq++; |
53 | 1.20M | return (s->sym_next == s->sym_end); |
54 | 1.20M | } Unexecuted instantiation: deflate.c:zng_tr_tally_dist deflate_fast.c:zng_tr_tally_dist Line | Count | Source | 40 | 341k | static inline int zng_tr_tally_dist(deflate_state *s, uint32_t dist, uint32_t len) { | 41 | | /* dist: distance of matched string */ | 42 | | /* len: match length-MIN_MATCH */ | 43 | 341k | s->sym_buf[s->sym_next++] = (uint8_t)(dist); | 44 | 341k | s->sym_buf[s->sym_next++] = (uint8_t)(dist >> 8); | 45 | 341k | s->sym_buf[s->sym_next++] = (uint8_t)len; | 46 | 341k | s->matches++; | 47 | 341k | dist--; | 48 | 341k | Assert(dist < MAX_DIST(s) && (uint16_t)d_code(dist) < (uint16_t)D_CODES, | 49 | 341k | "zng_tr_tally: bad match"); | 50 | | | 51 | 341k | s->dyn_ltree[zng_length_code[len]+LITERALS+1].Freq++; | 52 | 341k | s->dyn_dtree[d_code(dist)].Freq++; | 53 | 341k | return (s->sym_next == s->sym_end); | 54 | 341k | } |
deflate_medium.c:zng_tr_tally_dist Line | Count | Source | 40 | 591k | static inline int zng_tr_tally_dist(deflate_state *s, uint32_t dist, uint32_t len) { | 41 | | /* dist: distance of matched string */ | 42 | | /* len: match length-MIN_MATCH */ | 43 | 591k | s->sym_buf[s->sym_next++] = (uint8_t)(dist); | 44 | 591k | s->sym_buf[s->sym_next++] = (uint8_t)(dist >> 8); | 45 | 591k | s->sym_buf[s->sym_next++] = (uint8_t)len; | 46 | 591k | s->matches++; | 47 | 591k | dist--; | 48 | 591k | Assert(dist < MAX_DIST(s) && (uint16_t)d_code(dist) < (uint16_t)D_CODES, | 49 | 591k | "zng_tr_tally: bad match"); | 50 | | | 51 | 591k | s->dyn_ltree[zng_length_code[len]+LITERALS+1].Freq++; | 52 | 591k | s->dyn_dtree[d_code(dist)].Freq++; | 53 | 591k | return (s->sym_next == s->sym_end); | 54 | 591k | } |
Unexecuted instantiation: deflate_quick.c:zng_tr_tally_dist deflate_slow.c:zng_tr_tally_dist Line | Count | Source | 40 | 271k | static inline int zng_tr_tally_dist(deflate_state *s, uint32_t dist, uint32_t len) { | 41 | | /* dist: distance of matched string */ | 42 | | /* len: match length-MIN_MATCH */ | 43 | 271k | s->sym_buf[s->sym_next++] = (uint8_t)(dist); | 44 | 271k | s->sym_buf[s->sym_next++] = (uint8_t)(dist >> 8); | 45 | 271k | s->sym_buf[s->sym_next++] = (uint8_t)len; | 46 | 271k | s->matches++; | 47 | 271k | dist--; | 48 | 271k | Assert(dist < MAX_DIST(s) && (uint16_t)d_code(dist) < (uint16_t)D_CODES, | 49 | 271k | "zng_tr_tally: bad match"); | 50 | | | 51 | 271k | s->dyn_ltree[zng_length_code[len]+LITERALS+1].Freq++; | 52 | 271k | s->dyn_dtree[d_code(dist)].Freq++; | 53 | 271k | return (s->sym_next == s->sym_end); | 54 | 271k | } |
Unexecuted instantiation: functable.c:zng_tr_tally_dist |
55 | | |
56 | | /* =========================================================================== |
57 | | * Flush the current block, with given end-of-file flag. |
58 | | * IN assertion: strstart is set to the end of the current match. |
59 | | */ |
60 | 27.5k | #define FLUSH_BLOCK_ONLY(s, last) { \ |
61 | 27.5k | zng_tr_flush_block(s, (s->block_start >= 0 ? \ |
62 | 27.5k | (char *)&s->window[(unsigned)s->block_start] : \ |
63 | 27.5k | NULL), \ |
64 | 27.5k | (uint32_t)((int)s->strstart - s->block_start), \ |
65 | 27.5k | (last)); \ |
66 | 27.5k | s->block_start = (int)s->strstart; \ |
67 | 27.5k | flush_pending(s->strm); \ |
68 | 27.5k | } |
69 | | |
70 | | /* Same but force premature exit if necessary. */ |
71 | 27.5k | #define FLUSH_BLOCK(s, last) { \ |
72 | 27.5k | FLUSH_BLOCK_ONLY(s, last); \ |
73 | 27.5k | if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \ |
74 | 27.5k | } |
75 | | |
76 | | /* Maximum stored block length in deflate format (not including header). */ |
77 | 0 | #define MAX_STORED 65535 |
78 | | |
79 | | #endif |