X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Flzms_decompress.c;fp=src%2Flzms_decompress.c;h=070cdb64c2e057f412592c5350895313135d52f8;hp=47cd656194b7dc3b3e1a853d9f112b12b9a485f0;hb=6048988437e5d1409f10c51ed7292b322d2974d6;hpb=ff5bc819b64a59560c883bc3354fe4e4b2d7798c diff --git a/src/lzms_decompress.c b/src/lzms_decompress.c index 47cd6561..070cdb64 100644 --- a/src/lzms_decompress.c +++ b/src/lzms_decompress.c @@ -492,10 +492,6 @@ lzms_decode_bit(struct lzms_range_decoder *rd, u32 *state_p, u32 num_states, /* Load the probability entry corresponding to the current state. */ prob_entry = &probs[*state_p]; - /* Get the probability (out of LZMS_PROBABILITY_DENOMINATOR) that the - * next bit is 0. */ - prob = lzms_get_probability(prob_entry); - /* Normalize if needed. */ if (rd->range <= 0xffff) { rd->range <<= 16; @@ -504,6 +500,10 @@ lzms_decode_bit(struct lzms_range_decoder *rd, u32 *state_p, u32 num_states, rd->code |= le16_to_cpu(*rd->next++); } + /* Get the probability (out of LZMS_PROBABILITY_DENOMINATOR) that the + * next bit is 0. */ + prob = lzms_get_probability(prob_entry); + /* Based on the probability, calculate the bound between the 0-bit * region and the 1-bit region of the range. */ bound = (rd->range >> LZMS_PROBABILITY_BITS) * prob;