Lines Matching +full:three +full:- +full:state
1 /* SPDX-License-Identifier: 0BSD */
7 * Igor Pavlov <https://7-zip.org/>
22 * Maximum number of position states. A position state is the lowest pb
33 * - Literal: One 8-bit byte
34 * - Match: Repeat a chunk of data at some distance
35 * - Long repeat: Multi-byte match at a recently seen distance
36 * - Short repeat: One-byte repeat at a recently seen distance
39 * either short or long repeated match, and NONLIT means any non-literal.
59 /* The lowest 7 states indicate that the previous state was a literal. */
63 static inline void lzma_state_literal(enum lzma_state *state) in lzma_state_literal() argument
65 if (*state <= STATE_SHORTREP_LIT_LIT) in lzma_state_literal()
66 *state = STATE_LIT_LIT; in lzma_state_literal()
67 else if (*state <= STATE_LIT_SHORTREP) in lzma_state_literal()
68 *state -= 3; in lzma_state_literal()
70 *state -= 6; in lzma_state_literal()
74 static inline void lzma_state_match(enum lzma_state *state) in lzma_state_match() argument
76 *state = *state < LIT_STATES ? STATE_LIT_MATCH : STATE_NONLIT_MATCH; in lzma_state_match()
79 /* Indicate that the latest state was a long repeated match. */
80 static inline void lzma_state_long_rep(enum lzma_state *state) in lzma_state_long_rep() argument
82 *state = *state < LIT_STATES ? STATE_LIT_LONGREP : STATE_NONLIT_REP; in lzma_state_long_rep()
86 static inline void lzma_state_short_rep(enum lzma_state *state) in lzma_state_short_rep() argument
88 *state = *state < LIT_STATES ? STATE_LIT_SHORTREP : STATE_NONLIT_REP; in lzma_state_short_rep()
92 static inline bool lzma_state_is_literal(enum lzma_state state) in lzma_state_is_literal() argument
94 return state < LIT_STATES; in lzma_state_is_literal()
97 /* Each literal coder is divided in three sections:
98 * - 0x001-0x0FF: Without match byte
99 * - 0x101-0x1FF: With match byte; match bit is 0
100 * - 0x201-0x2FF: With match byte; match bit is 1
116 * 2-9 4 = Choice=0 + 3 bits
117 * 10-17 5 = Choice=1 + Choice2=0 + 3 bits
118 * 18-273 10 = Choice=1 + Choice2=1 + 8 bits
132 #define MATCH_LEN_MAX (MATCH_LEN_MIN + LEN_SYMBOLS - 1)
149 ? len - MATCH_LEN_MIN : DIST_STATES - 1; in lzma_get_dist_state()
153 * The highest two bits of a 32-bit match distance are encoded using six bits.
154 * This six-bit value is called a distance slot. This way encoding a 32-bit
155 * value takes 6-36 bits, larger values taking more bits.
162 * the distances 0-3 don't need any additional bits to encode, since the
170 * Match distances greater than 127 are encoded in three pieces:
171 * - distance slot: the highest two bits
172 * - direct bits: 2-26 bits below the highest two bits
173 * - alignment bits: four lowest bits
177 * The distance slot value of 14 is for distances 128-191.
191 #define ALIGN_MASK (ALIGN_SIZE - 1)
198 * distances tends to take less space than re-encoding the actual