Alex Converse <[email protected]> writes:

> On Thu, Apr 28, 2011 at 5:08 AM, Måns Rullgård <[email protected]> wrote:
>> Aℓex Converse <[email protected]> writes:
>>
>>> From ae62aa2fca3b2cf45a98dc2f9777065bcb452797 Mon Sep 17 00:00:00 2001
>>> From: Alex Converse <[email protected]>
>>> Date: Tue, 26 Apr 2011 09:08:26 -0700
>>> Subject: [PATCH 3/4] bitstream: Properly promote av_reverse values before 
>>> shifting.
>>> MIME-Version: 1.0
>>> Content-Type: multipart/mixed; boundary="------------1"
>>>
>>> This is a multi-part message in MIME format.
>>> --------------1
>>> Content-Type: text/plain; charset=UTF-8; format=fixed
>>> Content-Transfer-Encoding: 8bit
>>>
>>> ---
>>>  libavcodec/bitstream.c |    8 ++++----
>>>  1 files changed, 4 insertions(+), 4 deletions(-)
>>>
>>> --------------1
>>> Content-Type: text/x-patch; 
>>> name="0003-bitstream-Properly-promote-av_reverse-values-before-.patch"
>>> Content-Transfer-Encoding: 8bit
>>> Content-Disposition: attachment; 
>>> filename="0003-bitstream-Properly-promote-av_reverse-values-before-.patch"
>>>
>>> diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
>>> index 329ec95..14c3eaa 100644
>>> --- a/libavcodec/bitstream.c
>>> +++ b/libavcodec/bitstream.c
>>> @@ -118,10 +118,10 @@ static int alloc_table(VLC *vlc, int size, int 
>>> use_static)
>>>  }
>>>
>>>  static av_always_inline uint32_t bitswap_32(uint32_t x) {
>>> -    return av_reverse[x&0xFF]<<24
>>> -         | av_reverse[(x>>8)&0xFF]<<16
>>> -         | av_reverse[(x>>16)&0xFF]<<8
>>> -         | av_reverse[x>>24];
>>> +    return (uint32_t)av_reverse[x&0xFF]<<24
>>> +         | (uint32_t)av_reverse[(x>>8)&0xFF]<<16
>>> +         | (uint32_t)av_reverse[(x>>16)&0xFF]<<8
>>> +         | (uint32_t)av_reverse[x>>24];
>>>  }
>>
>> The integer promotions already do this.
>>
>
> We are operating on uint8_t and int. The promoted the result is an int
> because the full range of uint8_t can fit in int.

Patch OK.

Aside, this should be moved to some generic place.

-- 
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to