Coverage Report

Created: 2026-12-01 06:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/zlib-ng/trees_emit.h
Line
Count
Source
1
#ifndef TREES_EMIT_H_
2
#define TREES_EMIT_H_
3
4
#include "zbuild.h"
5
#include "trees.h"
6
7
#ifdef ZLIB_DEBUG
8
#  include <ctype.h>
9
#  include <inttypes.h>
10
#endif
11
12
13
/* trees.h */
14
extern Z_INTERNAL const ct_data static_ltree[L_CODES+2];
15
extern Z_INTERNAL const ct_data static_dtree[D_CODES];
16
17
extern Z_INTERNAL const unsigned char zng_dist_code[DIST_CODE_LEN];
18
extern Z_INTERNAL const unsigned char zng_length_code[STD_MAX_MATCH-STD_MIN_MATCH+1];
19
20
/* Combined mask + extra_bits tables for single-lookup optimization */
21
extern Z_INTERNAL const uint16_t lmask_extra[LENGTH_CODES];
22
extern Z_INTERNAL const uint32_t dmask_extra[D_CODES];
23
24
/* Bit buffer and deflate code stderr tracing */
25
#ifdef ZLIB_DEBUG
26
#  define trace_bits(s, value, length) { \
27
        Tracevv((stderr, " l %2d v %4llx ", (int)(length), (long long)(value))); \
28
        Assert(length > 0 && length <= BIT_BUF_SIZE, "invalid length"); \
29
    }
30
#  define trace_code(c) \
31
    if (z_verbose > 2) { \
32
        fprintf(stderr, "\ncd %3d ", (c)); \
33
    }
34
#else
35
#  define trace_bits(s, value, length)
36
#  define trace_code(c)
37
#endif
38
39
/* If not enough room in bi_buf, use (valid) bits from bi_buf and
40
 * (64 - bi_valid) bits from value, leaving (width - (64-bi_valid))
41
 * unused bits in value.
42
 */
43
75.4M
#define send_bits(s, t_val, t_len, bi_buf, bi_valid) do {\
44
75.4M
    Assert(bi_valid <= 64, "Too many bits in bi_valid");\
45
75.4M
    uint64_t val = (uint64_t)t_val;\
46
75.4M
    uint32_t len = (uint32_t)t_len;\
47
75.4M
    uint32_t total_bits = bi_valid + len;\
48
75.4M
    trace_bits(s, val, len);\
49
75.4M
    sent_bits_add(s, len);\
50
75.4M
    \
51
75.4M
    /* Unconditionally shift and merge values into the buffer */\
52
75.4M
    bi_buf |= val << bi_valid;\
53
75.4M
    \
54
75.4M
    /* Check if the 64-bit boundary was crossed */\
55
75.4M
    if (total_bits >= 64) {\
56
8.68M
        total_bits -= 64;\
57
8.68M
        put_uint64(s, bi_buf);\
58
8.68M
        \
59
8.68M
        /* Secure shift: prevent Undefined Behavior when bi_valid is 0 */\
60
8.68M
        /* If bi_valid is 0, we shift by 0 (via the mask) and overwrite bi_buf completely */\
61
8.68M
        bi_buf = (val >> 1) >> (~bi_valid & 63);\
62
8.68M
    }\
63
75.4M
    bi_valid = total_bits;\
64
75.4M
} while (0)
65
66
/* Merge bits into the bit buffer without flushing. The caller must guarantee room,
67
 * i.e. bi_valid + len <= 64. Pair with send_bits_flush, which leaves at most 7 bits. */
68
846M
#define send_bits_merge(s, t_val, t_len, bi_buf, bi_valid) do { \
69
846M
    Assert((bi_valid) + (uint32_t)(t_len) <= 64, "bit buffer overflow"); \
70
846M
    trace_bits(s, (uint64_t)(t_val), (uint32_t)(t_len)); \
71
846M
    sent_bits_add(s, t_len); \
72
846M
    bi_buf |= (uint64_t)(t_val) << (bi_valid); \
73
846M
    bi_valid += (uint32_t)(t_len); \
74
846M
} while (0)
75
76
/* Store the bit buffer unconditionally and consume its complete bytes, leaving at most
77
 * 7 valid bits. The unconditional 8-byte store reaches up to 7 bytes past the logical
78
 * output position, which the pending buffer layout must reserve room for
79
 * (see PENDING_BUF_PAD in deflate.c). */
80
316M
#define send_bits_flush(s, bi_buf, bi_valid, pending) do { \
81
316M
    zng_memwrite_8((s)->pending_buf + (pending), Z_U64_TO_LE(bi_buf)); \
82
316M
    pending += (bi_valid) >> 3; \
83
316M
    bi_buf >>= ((bi_valid) & ~7U); \
84
316M
    bi_valid &= 7; \
85
316M
} while (0)
86
87
/* Send a code of the given tree. c and tree must not have side effects */
88
#ifdef ZLIB_DEBUG
89
#  define send_code(s, c, tree, bi_buf, bi_valid) { \
90
    trace_code(c); \
91
    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid); \
92
}
93
#else
94
#  define send_code(s, c, tree, bi_buf, bi_valid) \
95
71.0M
    send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
96
#endif
97
98
/* Merge a code of the given tree without flushing. c and tree must not have side effects */
99
#ifdef ZLIB_DEBUG
100
#  define send_code_merge(s, c, tree, bi_buf, bi_valid) { \
101
    trace_code(c); \
102
    send_bits_merge(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid); \
103
}
104
#else
105
#  define send_code_merge(s, c, tree, bi_buf, bi_valid) \
106
808M
    send_bits_merge(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid)
107
#endif
108
109
/* ===========================================================================
110
 * Flush the bit buffer and align the output on a byte boundary
111
 */
112
113k
static inline void bi_windup(deflate_state *s) {
113
113k
    if (s->bi_valid > 56) {
114
123
        put_uint64(s, s->bi_buf);
115
113k
    } else {
116
113k
        if (s->bi_valid > 24) {
117
15.6k
            put_uint32(s, (uint32_t)s->bi_buf);
118
15.6k
            s->bi_buf >>= 32;
119
15.6k
            s->bi_valid -= 32;
120
15.6k
        }
121
113k
        if (s->bi_valid > 8) {
122
53.0k
            put_short(s, (uint16_t)s->bi_buf);
123
53.0k
            s->bi_buf >>= 16;
124
53.0k
            s->bi_valid -= 16;
125
53.0k
        }
126
113k
        if (s->bi_valid > 0) {
127
83.7k
            put_byte(s, s->bi_buf);
128
83.7k
        }
129
113k
    }
130
113k
    s->bi_used = ((s->bi_valid - 1) & 7) + 1;
131
113k
    s->bi_buf = 0;
132
113k
    s->bi_valid = 0;
133
113k
}
deflate_quick.c:bi_windup
Line
Count
Source
112
829
static inline void bi_windup(deflate_state *s) {
113
829
    if (s->bi_valid > 56) {
114
98
        put_uint64(s, s->bi_buf);
115
731
    } else {
116
731
        if (s->bi_valid > 24) {
117
422
            put_uint32(s, (uint32_t)s->bi_buf);
118
422
            s->bi_buf >>= 32;
119
422
            s->bi_valid -= 32;
120
422
        }
121
731
        if (s->bi_valid > 8) {
122
435
            put_short(s, (uint16_t)s->bi_buf);
123
435
            s->bi_buf >>= 16;
124
435
            s->bi_valid -= 16;
125
435
        }
126
731
        if (s->bi_valid > 0) {
127
404
            put_byte(s, s->bi_buf);
128
404
        }
129
731
    }
130
829
    s->bi_used = ((s->bi_valid - 1) & 7) + 1;
131
829
    s->bi_buf = 0;
132
829
    s->bi_valid = 0;
133
829
}
trees.c:bi_windup
Line
Count
Source
112
113k
static inline void bi_windup(deflate_state *s) {
113
113k
    if (s->bi_valid > 56) {
114
25
        put_uint64(s, s->bi_buf);
115
113k
    } else {
116
113k
        if (s->bi_valid > 24) {
117
15.1k
            put_uint32(s, (uint32_t)s->bi_buf);
118
15.1k
            s->bi_buf >>= 32;
119
15.1k
            s->bi_valid -= 32;
120
15.1k
        }
121
113k
        if (s->bi_valid > 8) {
122
52.6k
            put_short(s, (uint16_t)s->bi_buf);
123
52.6k
            s->bi_buf >>= 16;
124
52.6k
            s->bi_valid -= 16;
125
52.6k
        }
126
113k
        if (s->bi_valid > 0) {
127
83.2k
            put_byte(s, s->bi_buf);
128
83.2k
        }
129
113k
    }
130
113k
    s->bi_used = ((s->bi_valid - 1) & 7) + 1;
131
113k
    s->bi_buf = 0;
132
113k
    s->bi_valid = 0;
133
113k
}
134
135
/* ===========================================================================
136
 * Emit literal code
137
 */
138
Z_FORCEINLINE static void zng_emit_lit(deflate_state *s, const ct_data *ltree, unsigned c,
139
60.0M
                                uint64_t *bi_buf, uint32_t *bi_valid) {
140
60.0M
    send_code(s, c, ltree, *bi_buf, *bi_valid);
141
60.0M
    Tracecv(isgraph(c & 0xff), (stderr, " '%c' ", c));
142
60.0M
}
deflate_quick.c:zng_emit_lit
Line
Count
Source
139
60.0M
                                uint64_t *bi_buf, uint32_t *bi_valid) {
140
60.0M
    send_code(s, c, ltree, *bi_buf, *bi_valid);
141
60.0M
    Tracecv(isgraph(c & 0xff), (stderr, " '%c' ", c));
142
60.0M
}
Unexecuted instantiation: trees.c:zng_emit_lit
143
144
/* ===========================================================================
145
 * Assemble a match's length code + extra bits + distance code + extra bits into
146
 * a single bit string, at most 48 bits. Returns the bits, length via *bits_len.
147
 */
148
38.4M
Z_FORCEINLINE static uint64_t zng_assemble_dist(const ct_data *ltree, const ct_data *dtree, uint32_t lc, uint32_t dist, uint32_t *bits_len) {
149
38.4M
    uint64_t match_bits;
150
38.4M
    uint32_t match_bits_len;
151
38.4M
    uint32_t mask_ext;  // Contains both mask and extra, can safely be used directly as mask
152
                        // due to extra bits being outside the range of lc and dist data.
153
38.4M
    uint32_t c, extra;
154
38.4M
    uint8_t code;
155
156
    /* 1. Process Length Code */
157
38.4M
    code = zng_length_code[lc];
158
38.4M
    c = code + LITERALS + 1;
159
38.4M
    Assert(c < L_CODES, "bad l_code");
160
38.4M
    trace_code(c);
161
162
    /*    Send length code, len is the match length - STD_MIN_MATCH */
163
38.4M
    match_bits = ltree[c].Code;
164
38.4M
    match_bits_len = ltree[c].Len;
165
166
    /* 2. Get extra bits count and mask */
167
38.4M
    mask_ext = lmask_extra[code];
168
38.4M
    extra = mask_ext >> 8;
169
170
    /*    Send length extra bits */
171
38.4M
    match_bits |= (uint64_t)(lc & mask_ext) << match_bits_len;
172
38.4M
    match_bits_len += extra;
173
174
    /* 3. Process Distance Code */
175
38.4M
    dist--; /* dist is now the match distance - 1 */
176
38.4M
    code = d_code(dist);
177
38.4M
    Assert(code < D_CODES, "bad d_code");
178
38.4M
    trace_code(code);
179
180
    /*    Send distance code */
181
38.4M
    match_bits |= ((uint64_t)dtree[code].Code << match_bits_len);
182
38.4M
    match_bits_len += dtree[code].Len;
183
184
    /* 4. Get extra bits count and mask */
185
38.4M
    mask_ext = dmask_extra[code];
186
38.4M
    extra = mask_ext >> 16;
187
188
    /*    Send dist extra bits */
189
38.4M
    match_bits |= ((uint64_t)(dist & mask_ext) << match_bits_len);
190
38.4M
    match_bits_len += extra;
191
192
38.4M
    *bits_len = match_bits_len;
193
38.4M
    return match_bits;
194
38.4M
}
deflate_quick.c:zng_assemble_dist
Line
Count
Source
148
491k
Z_FORCEINLINE static uint64_t zng_assemble_dist(const ct_data *ltree, const ct_data *dtree, uint32_t lc, uint32_t dist, uint32_t *bits_len) {
149
491k
    uint64_t match_bits;
150
491k
    uint32_t match_bits_len;
151
491k
    uint32_t mask_ext;  // Contains both mask and extra, can safely be used directly as mask
152
                        // due to extra bits being outside the range of lc and dist data.
153
491k
    uint32_t c, extra;
154
491k
    uint8_t code;
155
156
    /* 1. Process Length Code */
157
491k
    code = zng_length_code[lc];
158
491k
    c = code + LITERALS + 1;
159
491k
    Assert(c < L_CODES, "bad l_code");
160
491k
    trace_code(c);
161
162
    /*    Send length code, len is the match length - STD_MIN_MATCH */
163
491k
    match_bits = ltree[c].Code;
164
491k
    match_bits_len = ltree[c].Len;
165
166
    /* 2. Get extra bits count and mask */
167
491k
    mask_ext = lmask_extra[code];
168
491k
    extra = mask_ext >> 8;
169
170
    /*    Send length extra bits */
171
491k
    match_bits |= (uint64_t)(lc & mask_ext) << match_bits_len;
172
491k
    match_bits_len += extra;
173
174
    /* 3. Process Distance Code */
175
491k
    dist--; /* dist is now the match distance - 1 */
176
491k
    code = d_code(dist);
177
491k
    Assert(code < D_CODES, "bad d_code");
178
491k
    trace_code(code);
179
180
    /*    Send distance code */
181
491k
    match_bits |= ((uint64_t)dtree[code].Code << match_bits_len);
182
491k
    match_bits_len += dtree[code].Len;
183
184
    /* 4. Get extra bits count and mask */
185
491k
    mask_ext = dmask_extra[code];
186
491k
    extra = mask_ext >> 16;
187
188
    /*    Send dist extra bits */
189
491k
    match_bits |= ((uint64_t)(dist & mask_ext) << match_bits_len);
190
491k
    match_bits_len += extra;
191
192
491k
    *bits_len = match_bits_len;
193
491k
    return match_bits;
194
491k
}
trees.c:zng_assemble_dist
Line
Count
Source
148
37.9M
Z_FORCEINLINE static uint64_t zng_assemble_dist(const ct_data *ltree, const ct_data *dtree, uint32_t lc, uint32_t dist, uint32_t *bits_len) {
149
37.9M
    uint64_t match_bits;
150
37.9M
    uint32_t match_bits_len;
151
37.9M
    uint32_t mask_ext;  // Contains both mask and extra, can safely be used directly as mask
152
                        // due to extra bits being outside the range of lc and dist data.
153
37.9M
    uint32_t c, extra;
154
37.9M
    uint8_t code;
155
156
    /* 1. Process Length Code */
157
37.9M
    code = zng_length_code[lc];
158
37.9M
    c = code + LITERALS + 1;
159
37.9M
    Assert(c < L_CODES, "bad l_code");
160
37.9M
    trace_code(c);
161
162
    /*    Send length code, len is the match length - STD_MIN_MATCH */
163
37.9M
    match_bits = ltree[c].Code;
164
37.9M
    match_bits_len = ltree[c].Len;
165
166
    /* 2. Get extra bits count and mask */
167
37.9M
    mask_ext = lmask_extra[code];
168
37.9M
    extra = mask_ext >> 8;
169
170
    /*    Send length extra bits */
171
37.9M
    match_bits |= (uint64_t)(lc & mask_ext) << match_bits_len;
172
37.9M
    match_bits_len += extra;
173
174
    /* 3. Process Distance Code */
175
37.9M
    dist--; /* dist is now the match distance - 1 */
176
37.9M
    code = d_code(dist);
177
37.9M
    Assert(code < D_CODES, "bad d_code");
178
37.9M
    trace_code(code);
179
180
    /*    Send distance code */
181
37.9M
    match_bits |= ((uint64_t)dtree[code].Code << match_bits_len);
182
37.9M
    match_bits_len += dtree[code].Len;
183
184
    /* 4. Get extra bits count and mask */
185
37.9M
    mask_ext = dmask_extra[code];
186
37.9M
    extra = mask_ext >> 16;
187
188
    /*    Send dist extra bits */
189
37.9M
    match_bits |= ((uint64_t)(dist & mask_ext) << match_bits_len);
190
37.9M
    match_bits_len += extra;
191
192
37.9M
    *bits_len = match_bits_len;
193
37.9M
    return match_bits;
194
37.9M
}
195
196
/* ===========================================================================
197
 * Emit match distance/length code
198
 */
199
static inline uint32_t zng_emit_dist(deflate_state *s, const ct_data *ltree, const ct_data *dtree,
200
491k
                                     uint32_t lc, uint32_t dist, uint64_t *bi_buf, uint32_t *bi_valid) {
201
491k
    uint32_t match_bits_len;
202
491k
    uint64_t match_bits = zng_assemble_dist(ltree, dtree, lc, dist, &match_bits_len);
203
204
491k
    send_bits(s, match_bits, match_bits_len, *bi_buf, *bi_valid);
205
206
491k
    return match_bits_len;
207
491k
}
deflate_quick.c:zng_emit_dist
Line
Count
Source
200
491k
                                     uint32_t lc, uint32_t dist, uint64_t *bi_buf, uint32_t *bi_valid) {
201
491k
    uint32_t match_bits_len;
202
491k
    uint64_t match_bits = zng_assemble_dist(ltree, dtree, lc, dist, &match_bits_len);
203
204
491k
    send_bits(s, match_bits, match_bits_len, *bi_buf, *bi_valid);
205
206
491k
    return match_bits_len;
207
491k
}
Unexecuted instantiation: trees.c:zng_emit_dist
208
209
/* ===========================================================================
210
 * Emit end block
211
 */
212
static inline void zng_emit_end_block(deflate_state *s, const ct_data *ltree, const int last,
213
157k
                                      uint64_t *bi_buf, uint32_t *bi_valid) {
214
157k
    send_code(s, END_BLOCK, ltree, *bi_buf, *bi_valid);
215
157k
    Tracev((stderr, "\n+++ Emit End Block: Last: %u Pending: %u Total Out: %" PRIu64 "\n",
216
157k
        last, s->pending, (uint64_t)s->strm->total_out));
217
157k
    Z_UNUSED(last);
218
157k
}
deflate_quick.c:zng_emit_end_block
Line
Count
Source
213
1.01k
                                      uint64_t *bi_buf, uint32_t *bi_valid) {
214
1.01k
    send_code(s, END_BLOCK, ltree, *bi_buf, *bi_valid);
215
1.01k
    Tracev((stderr, "\n+++ Emit End Block: Last: %u Pending: %u Total Out: %" PRIu64 "\n",
216
1.01k
        last, s->pending, (uint64_t)s->strm->total_out));
217
1.01k
    Z_UNUSED(last);
218
1.01k
}
trees.c:zng_emit_end_block
Line
Count
Source
213
156k
                                      uint64_t *bi_buf, uint32_t *bi_valid) {
214
156k
    send_code(s, END_BLOCK, ltree, *bi_buf, *bi_valid);
215
156k
    Tracev((stderr, "\n+++ Emit End Block: Last: %u Pending: %u Total Out: %" PRIu64 "\n",
216
156k
        last, s->pending, (uint64_t)s->strm->total_out));
217
156k
    Z_UNUSED(last);
218
156k
}
219
220
/* ===========================================================================
221
 * Emit literal and count bits
222
 */
223
60.0M
static inline void zng_tr_emit_lit(deflate_state *s, const ct_data *ltree, unsigned c) {
224
60.0M
    uint64_t bi_buf = s->bi_buf;
225
60.0M
    uint32_t bi_valid = s->bi_valid;
226
60.0M
    zng_emit_lit(s, ltree, c, &bi_buf, &bi_valid);
227
60.0M
    s->bi_buf = bi_buf;
228
60.0M
    s->bi_valid = bi_valid;
229
60.0M
    cmpr_bits_add(s, ltree[c].Len);
230
60.0M
}
deflate_quick.c:zng_tr_emit_lit
Line
Count
Source
223
60.0M
static inline void zng_tr_emit_lit(deflate_state *s, const ct_data *ltree, unsigned c) {
224
60.0M
    uint64_t bi_buf = s->bi_buf;
225
60.0M
    uint32_t bi_valid = s->bi_valid;
226
60.0M
    zng_emit_lit(s, ltree, c, &bi_buf, &bi_valid);
227
60.0M
    s->bi_buf = bi_buf;
228
60.0M
    s->bi_valid = bi_valid;
229
60.0M
    cmpr_bits_add(s, ltree[c].Len);
230
60.0M
}
Unexecuted instantiation: trees.c:zng_tr_emit_lit
231
232
/* ===========================================================================
233
 * Emit match and count bits
234
 */
235
static inline void zng_tr_emit_dist(deflate_state *s, const ct_data *ltree, const ct_data *dtree,
236
491k
    uint32_t lc, uint32_t dist) {
237
491k
    uint64_t bi_buf = s->bi_buf;
238
491k
    uint32_t bi_valid = s->bi_valid;
239
491k
    uint32_t bits = zng_emit_dist(s, ltree, dtree, lc, dist, &bi_buf, &bi_valid);
240
491k
    s->bi_buf = bi_buf;
241
491k
    s->bi_valid = bi_valid;
242
491k
    cmpr_bits_add(s, bits);
243
491k
}
deflate_quick.c:zng_tr_emit_dist
Line
Count
Source
236
491k
    uint32_t lc, uint32_t dist) {
237
491k
    uint64_t bi_buf = s->bi_buf;
238
491k
    uint32_t bi_valid = s->bi_valid;
239
491k
    uint32_t bits = zng_emit_dist(s, ltree, dtree, lc, dist, &bi_buf, &bi_valid);
240
491k
    s->bi_buf = bi_buf;
241
491k
    s->bi_valid = bi_valid;
242
491k
    cmpr_bits_add(s, bits);
243
491k
}
Unexecuted instantiation: trees.c:zng_tr_emit_dist
244
245
/* ===========================================================================
246
 * Emit start of block
247
 */
248
200k
static inline void zng_tr_emit_tree(deflate_state *s, int type, const int last) {
249
200k
    uint32_t bi_valid = s->bi_valid;
250
200k
    uint64_t bi_buf = s->bi_buf;
251
200k
    uint32_t header_bits = (type << 1) + last;
252
200k
    send_bits(s, header_bits, 3, bi_buf, bi_valid);
253
200k
    cmpr_bits_add(s, 3);
254
200k
    s->bi_valid = bi_valid;
255
200k
    s->bi_buf = bi_buf;
256
200k
    Tracev((stderr, "\n--- Emit Tree: Last: %u\n", last));
257
200k
}
deflate_quick.c:zng_tr_emit_tree
Line
Count
Source
248
1.01k
static inline void zng_tr_emit_tree(deflate_state *s, int type, const int last) {
249
1.01k
    uint32_t bi_valid = s->bi_valid;
250
1.01k
    uint64_t bi_buf = s->bi_buf;
251
1.01k
    uint32_t header_bits = (type << 1) + last;
252
1.01k
    send_bits(s, header_bits, 3, bi_buf, bi_valid);
253
1.01k
    cmpr_bits_add(s, 3);
254
1.01k
    s->bi_valid = bi_valid;
255
1.01k
    s->bi_buf = bi_buf;
256
1.01k
    Tracev((stderr, "\n--- Emit Tree: Last: %u\n", last));
257
1.01k
}
trees.c:zng_tr_emit_tree
Line
Count
Source
248
199k
static inline void zng_tr_emit_tree(deflate_state *s, int type, const int last) {
249
199k
    uint32_t bi_valid = s->bi_valid;
250
199k
    uint64_t bi_buf = s->bi_buf;
251
199k
    uint32_t header_bits = (type << 1) + last;
252
199k
    send_bits(s, header_bits, 3, bi_buf, bi_valid);
253
199k
    cmpr_bits_add(s, 3);
254
199k
    s->bi_valid = bi_valid;
255
199k
    s->bi_buf = bi_buf;
256
199k
    Tracev((stderr, "\n--- Emit Tree: Last: %u\n", last));
257
199k
}
258
259
/* ===========================================================================
260
 * Align bit buffer on a byte boundary and count bits
261
 */
262
113k
static inline void zng_tr_emit_align(deflate_state *s) {
263
113k
    bi_windup(s); /* align on byte boundary */
264
113k
    sent_bits_align(s);
265
113k
}
deflate_quick.c:zng_tr_emit_align
Line
Count
Source
262
829
static inline void zng_tr_emit_align(deflate_state *s) {
263
829
    bi_windup(s); /* align on byte boundary */
264
829
    sent_bits_align(s);
265
829
}
trees.c:zng_tr_emit_align
Line
Count
Source
262
113k
static inline void zng_tr_emit_align(deflate_state *s) {
263
113k
    bi_windup(s); /* align on byte boundary */
264
113k
    sent_bits_align(s);
265
113k
}
266
267
/* ===========================================================================
268
 * Emit an end block and align bit buffer if last block
269
 */
270
1.01k
static inline void zng_tr_emit_end_block(deflate_state *s, const ct_data *ltree, const int last) {
271
1.01k
    uint64_t bi_buf = s->bi_buf;
272
1.01k
    uint32_t bi_valid = s->bi_valid;
273
1.01k
    zng_emit_end_block(s, ltree, last, &bi_buf, &bi_valid);
274
1.01k
    s->bi_buf = bi_buf;
275
1.01k
    s->bi_valid = bi_valid;
276
1.01k
    cmpr_bits_add(s, 7);
277
1.01k
    if (last)
278
829
        zng_tr_emit_align(s);
279
1.01k
}
deflate_quick.c:zng_tr_emit_end_block
Line
Count
Source
270
1.01k
static inline void zng_tr_emit_end_block(deflate_state *s, const ct_data *ltree, const int last) {
271
1.01k
    uint64_t bi_buf = s->bi_buf;
272
1.01k
    uint32_t bi_valid = s->bi_valid;
273
1.01k
    zng_emit_end_block(s, ltree, last, &bi_buf, &bi_valid);
274
1.01k
    s->bi_buf = bi_buf;
275
1.01k
    s->bi_valid = bi_valid;
276
1.01k
    cmpr_bits_add(s, 7);
277
1.01k
    if (last)
278
829
        zng_tr_emit_align(s);
279
1.01k
}
Unexecuted instantiation: trees.c:zng_tr_emit_end_block
280
281
#endif