-
- /* Record the literal run length for the next sequence (the
- * "previous sequence" when walking backwards). */
- if (record) {
- c->chosen_sequences[seq_idx--].litrunlen =
- lit_start_node - node_idx;
- node_idx -= len;
- lit_start_node = node_idx;
- } else {
- node_idx -= len;
- }
-
- /* Record a match. */
-
- /* Tally the aligned offset symbol if needed. */
- if (adjusted_offset >= LZX_MIN_ALIGNED_OFFSET + LZX_OFFSET_ADJUSTMENT)
- c->freqs.aligned[adjusted_offset & LZX_ALIGNED_OFFSET_BITMASK]++;
-
- /* Record the adjusted length. */
- v = len - LZX_MIN_MATCH_LEN;
- if (record)
- c->chosen_sequences[seq_idx].adjusted_length = v;
-
- /* Tally the length symbol if needed. */
- if (v >= LZX_NUM_PRIMARY_LENS) {
- c->freqs.len[v - LZX_NUM_PRIMARY_LENS]++;
- v = LZX_NUM_PRIMARY_LENS;
- }
-
- /* Tally the main symbol. */
- offset_slot = lzx_get_offset_slot(c, adjusted_offset, is_16_bit);
- v += offset_slot * LZX_NUM_LEN_HEADERS;
- c->freqs.main[LZX_NUM_CHARS + v]++;
-
- /* Record the adjusted offset and match header. */
+ mainsym = lzx_tally_main_and_lensyms(c, matchlen,
+ adjusted_offset,
+ is_16_bit);
+ if (adjusted_offset >= LZX_MIN_ALIGNED_OFFSET +
+ LZX_OFFSET_ADJUSTMENT)
+ c->freqs.aligned[adjusted_offset &
+ LZX_ALIGNED_OFFSET_BITMASK]++;