-/*
- * Decode a bit. This wraps around lzms_range_decode_bit() to handle using and
- * updating the state and its corresponding probability entry.
- */
-static inline int
-lzms_decode_bit(struct lzms_range_decoder *rd, u32 *state_p, u32 num_states,
- struct lzms_probability_entry *probs)
-{
- struct lzms_probability_entry *prob_entry;
- u32 prob;
- int bit;
-
- /* Load the probability entry corresponding to the current state. */
- prob_entry = &probs[*state_p];
-
- /* Get the probability that the next bit is 0. */
- prob = lzms_get_probability(prob_entry);
-
- /* Decode the next bit. */
- bit = lzms_range_decode_bit(rd, prob);
-
- /* Update the state and probability entry based on the decoded bit. */
- *state_p = ((*state_p << 1) | bit) & (num_states - 1);
- lzms_update_probability_entry(prob_entry, bit);
-
- /* Return the decoded bit. */
- return bit;
-}
-