15 #define RC_SHIFT_BITS 8 16 #define RC_TOP_BITS 24 17 #define RC_TOP_VALUE (1 << RC_TOP_BITS) 18 #define RC_BIT_MODEL_TOTAL_BITS 11 19 #define RC_BIT_MODEL_TOTAL (1 << RC_BIT_MODEL_TOTAL_BITS) 20 #define RC_MOVE_BITS 5 27 #define POS_STATES_MAX (1 << 4) 46 STATE_SHORTREP_LIT_LIT,
64 static inline void lzma_state_literal(
enum lzma_state *state)
66 if (*state <= STATE_SHORTREP_LIT_LIT)
67 *state = STATE_LIT_LIT;
68 else if (*state <= STATE_LIT_SHORTREP)
75 static inline void lzma_state_match(
enum lzma_state *state)
77 *state = *state < LIT_STATES ? STATE_LIT_MATCH : STATE_NONLIT_MATCH;
81 static inline void lzma_state_long_rep(
enum lzma_state *state)
83 *state = *state < LIT_STATES ? STATE_LIT_LONGREP : STATE_NONLIT_REP;
87 static inline void lzma_state_short_rep(
enum lzma_state *state)
89 *state = *state < LIT_STATES ? STATE_LIT_SHORTREP : STATE_NONLIT_REP;
93 static inline bool lzma_state_is_literal(
enum lzma_state state)
95 return state < LIT_STATES;
106 #define LITERAL_CODER_SIZE 0x300 109 #define LITERAL_CODERS_MAX (1 << 4) 112 #define MATCH_LEN_MIN 2 121 #define LEN_LOW_BITS 3 122 #define LEN_LOW_SYMBOLS (1 << LEN_LOW_BITS) 123 #define LEN_MID_BITS 3 124 #define LEN_MID_SYMBOLS (1 << LEN_MID_BITS) 125 #define LEN_HIGH_BITS 8 126 #define LEN_HIGH_SYMBOLS (1 << LEN_HIGH_BITS) 127 #define LEN_SYMBOLS (LEN_LOW_SYMBOLS + LEN_MID_SYMBOLS + LEN_HIGH_SYMBOLS) 133 #define MATCH_LEN_MAX (MATCH_LEN_MIN + LEN_SYMBOLS - 1) 141 #define DIST_STATES 4 147 static inline uint32_t lzma_get_dist_state(uint32_t len)
149 return len < DIST_STATES + MATCH_LEN_MIN
150 ? len - MATCH_LEN_MIN : DIST_STATES - 1;
158 #define DIST_SLOT_BITS 6 159 #define DIST_SLOTS (1 << DIST_SLOT_BITS) 168 #define DIST_MODEL_START 4 180 #define DIST_MODEL_END 14 183 #define FULL_DISTANCES_BITS (DIST_MODEL_END / 2) 184 #define FULL_DISTANCES (1 << FULL_DISTANCES_BITS) 191 #define ALIGN_SIZE (1 << ALIGN_BITS) 192 #define ALIGN_MASK (ALIGN_SIZE - 1) 195 #define PROBS_TOTAL (1846 + LITERAL_CODERS_MAX * LITERAL_CODER_SIZE)