From 290d1022b2d90503735728d7feed35a53a69f631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Delm=C3=A1s?= Date: Mon, 3 Sep 2012 17:32:01 +0200 Subject: [PATCH] mss2: simplify loop in decode_rle() It calculates the sum of power of two series, which can be done in one step. Suggested by Michael Niedermayer Signed-off-by: Kostya Shishkov --- libavcodec/mss2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c index 9914562da6..fbdc72c5c7 100644 --- a/libavcodec/mss2.c +++ b/libavcodec/mss2.c @@ -335,8 +335,7 @@ static int decode_rle(GetBitContext *gb, uint8_t *pal_dst, int pal_stride, else repeat = get_bits(gb, b); - while (b--) - repeat += 1 << b; + repeat += (1 << b) - 1; if (last_symbol == -2) { int skip = FFMIN(repeat, pal_dst + w - pp);