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