/src/c-blosc2/internal-complibs/zlib-ng-2.0.7/deflate_p.h
Line | Count | Source |
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 | 47.2M | static inline int zng_tr_tally_lit(deflate_state *s, unsigned char c) { |
30 | | /* c is the unmatched char */ |
31 | 47.2M | s->sym_buf[s->sym_next++] = 0; |
32 | 47.2M | s->sym_buf[s->sym_next++] = 0; |
33 | 47.2M | s->sym_buf[s->sym_next++] = c; |
34 | 47.2M | s->dyn_ltree[c].Freq++; |
35 | 47.2M | Tracevv((stderr, "%c", c)); |
36 | 47.2M | Assert(c <= (MAX_MATCH-MIN_MATCH), "zng_tr_tally: bad literal"); |
37 | 47.2M | return (s->sym_next == s->sym_end); |
38 | 47.2M | } Unexecuted instantiation: deflate.c:zng_tr_tally_lit deflate_fast.c:zng_tr_tally_lit Line | Count | Source | 29 | 14.6M | static inline int zng_tr_tally_lit(deflate_state *s, unsigned char c) { | 30 | | /* c is the unmatched char */ | 31 | 14.6M | s->sym_buf[s->sym_next++] = 0; | 32 | 14.6M | s->sym_buf[s->sym_next++] = 0; | 33 | 14.6M | s->sym_buf[s->sym_next++] = c; | 34 | 14.6M | s->dyn_ltree[c].Freq++; | 35 | 14.6M | Tracevv((stderr, "%c", c)); | 36 | 14.6M | Assert(c <= (MAX_MATCH-MIN_MATCH), "zng_tr_tally: bad literal"); | 37 | 14.6M | return (s->sym_next == s->sym_end); | 38 | 14.6M | } |
deflate_medium.c:zng_tr_tally_lit Line | Count | Source | 29 | 12.1M | static inline int zng_tr_tally_lit(deflate_state *s, unsigned char c) { | 30 | | /* c is the unmatched char */ | 31 | 12.1M | s->sym_buf[s->sym_next++] = 0; | 32 | 12.1M | s->sym_buf[s->sym_next++] = 0; | 33 | 12.1M | s->sym_buf[s->sym_next++] = c; | 34 | 12.1M | s->dyn_ltree[c].Freq++; | 35 | 12.1M | Tracevv((stderr, "%c", c)); | 36 | 12.1M | Assert(c <= (MAX_MATCH-MIN_MATCH), "zng_tr_tally: bad literal"); | 37 | 12.1M | return (s->sym_next == s->sym_end); | 38 | 12.1M | } |
Unexecuted instantiation: deflate_quick.c:zng_tr_tally_lit deflate_slow.c:zng_tr_tally_lit Line | Count | Source | 29 | 20.4M | static inline int zng_tr_tally_lit(deflate_state *s, unsigned char c) { | 30 | | /* c is the unmatched char */ | 31 | 20.4M | s->sym_buf[s->sym_next++] = 0; | 32 | 20.4M | s->sym_buf[s->sym_next++] = 0; | 33 | 20.4M | s->sym_buf[s->sym_next++] = c; | 34 | 20.4M | s->dyn_ltree[c].Freq++; | 35 | 20.4M | Tracevv((stderr, "%c", c)); | 36 | 20.4M | Assert(c <= (MAX_MATCH-MIN_MATCH), "zng_tr_tally: bad literal"); | 37 | 20.4M | return (s->sym_next == s->sym_end); | 38 | 20.4M | } |
Unexecuted instantiation: functable.c:zng_tr_tally_lit |
39 | | |
40 | 1.18M | 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.18M | s->sym_buf[s->sym_next++] = (uint8_t)(dist); |
44 | 1.18M | s->sym_buf[s->sym_next++] = (uint8_t)(dist >> 8); |
45 | 1.18M | s->sym_buf[s->sym_next++] = (uint8_t)len; |
46 | 1.18M | s->matches++; |
47 | 1.18M | dist--; |
48 | 1.18M | Assert(dist < MAX_DIST(s) && (uint16_t)d_code(dist) < (uint16_t)D_CODES, |
49 | 1.18M | "zng_tr_tally: bad match"); |
50 | | |
51 | 1.18M | s->dyn_ltree[zng_length_code[len]+LITERALS+1].Freq++; |
52 | 1.18M | s->dyn_dtree[d_code(dist)].Freq++; |
53 | 1.18M | return (s->sym_next == s->sym_end); |
54 | 1.18M | } Unexecuted instantiation: deflate.c:zng_tr_tally_dist deflate_fast.c:zng_tr_tally_dist Line | Count | Source | 40 | 346k | 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 | 346k | s->sym_buf[s->sym_next++] = (uint8_t)(dist); | 44 | 346k | s->sym_buf[s->sym_next++] = (uint8_t)(dist >> 8); | 45 | 346k | s->sym_buf[s->sym_next++] = (uint8_t)len; | 46 | 346k | s->matches++; | 47 | 346k | dist--; | 48 | 346k | Assert(dist < MAX_DIST(s) && (uint16_t)d_code(dist) < (uint16_t)D_CODES, | 49 | 346k | "zng_tr_tally: bad match"); | 50 | | | 51 | 346k | s->dyn_ltree[zng_length_code[len]+LITERALS+1].Freq++; | 52 | 346k | s->dyn_dtree[d_code(dist)].Freq++; | 53 | 346k | return (s->sym_next == s->sym_end); | 54 | 346k | } |
deflate_medium.c:zng_tr_tally_dist Line | Count | Source | 40 | 577k | 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 | 577k | s->sym_buf[s->sym_next++] = (uint8_t)(dist); | 44 | 577k | s->sym_buf[s->sym_next++] = (uint8_t)(dist >> 8); | 45 | 577k | s->sym_buf[s->sym_next++] = (uint8_t)len; | 46 | 577k | s->matches++; | 47 | 577k | dist--; | 48 | 577k | Assert(dist < MAX_DIST(s) && (uint16_t)d_code(dist) < (uint16_t)D_CODES, | 49 | 577k | "zng_tr_tally: bad match"); | 50 | | | 51 | 577k | s->dyn_ltree[zng_length_code[len]+LITERALS+1].Freq++; | 52 | 577k | s->dyn_dtree[d_code(dist)].Freq++; | 53 | 577k | return (s->sym_next == s->sym_end); | 54 | 577k | } |
Unexecuted instantiation: deflate_quick.c:zng_tr_tally_dist deflate_slow.c:zng_tr_tally_dist Line | Count | Source | 40 | 259k | 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 | 259k | s->sym_buf[s->sym_next++] = (uint8_t)(dist); | 44 | 259k | s->sym_buf[s->sym_next++] = (uint8_t)(dist >> 8); | 45 | 259k | s->sym_buf[s->sym_next++] = (uint8_t)len; | 46 | 259k | s->matches++; | 47 | 259k | dist--; | 48 | 259k | Assert(dist < MAX_DIST(s) && (uint16_t)d_code(dist) < (uint16_t)D_CODES, | 49 | 259k | "zng_tr_tally: bad match"); | 50 | | | 51 | 259k | s->dyn_ltree[zng_length_code[len]+LITERALS+1].Freq++; | 52 | 259k | s->dyn_dtree[d_code(dist)].Freq++; | 53 | 259k | return (s->sym_next == s->sym_end); | 54 | 259k | } |
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 | 26.2k | #define FLUSH_BLOCK_ONLY(s, last) { \ |
61 | 26.2k | zng_tr_flush_block(s, (s->block_start >= 0 ? \ |
62 | 26.2k | (char *)&s->window[(unsigned)s->block_start] : \ |
63 | 26.2k | NULL), \ |
64 | 26.2k | (uint32_t)((int)s->strstart - s->block_start), \ |
65 | 26.2k | (last)); \ |
66 | 26.2k | s->block_start = (int)s->strstart; \ |
67 | 26.2k | flush_pending(s->strm); \ |
68 | 26.2k | } |
69 | | |
70 | | /* Same but force premature exit if necessary. */ |
71 | 26.2k | #define FLUSH_BLOCK(s, last) { \ |
72 | 26.2k | FLUSH_BLOCK_ONLY(s, last); \ |
73 | 26.2k | if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \ |
74 | 26.2k | } |
75 | | |
76 | | /* Maximum stored block length in deflate format (not including header). */ |
77 | 0 | #define MAX_STORED 65535 |
78 | | |
79 | | #endif |