[FFmpeg-cvslog] r13277 - trunk/libavcodec/ra144.c

Vitor Sessak vitor1001
Sat May 24 14:22:05 CEST 2008


Michael Niedermayer wrote:
> On Sat, May 24, 2008 at 01:11:14PM +0200, Vitor Sessak wrote:
>> Michael Niedermayer wrote:
>>> On Sat, May 24, 2008 at 11:20:09AM +0200, vitor wrote:
>>>> Author: vitor
>>>> Date: Sat May 24 11:20:09 2008
>>>> New Revision: 13277
>>>>
>>>> Log:
>>>> Simplify final()
>>> [...]
>>>> -        x = ptr[10] - sum;
>>> [...]
>>>>  
>>>> -        if (x<-32768 || x>32767) {
>>>> +        if (ptr[10] - sum < -32768 || ptr[10] - sum > 32767) {
>>> [...]
>>>> -        ptr[10] = x;
>>>> +        ptr[10] -= sum;
>>> I would not call that part simplification.
>> Why? I found that adding a auxiliary var just to simplify an if 
>> obfuscate the code (it's harder to see that with no overflow, this code 
>> just do ptr[10] -= sum)...
> 
> 3 redundant subtractions ...

Is gcc (or any modern compiler) stupid enough not to optimize it? But 
anyway, if you prefer I can undo this.

> of course x is a bad name
> new_val would be better

I agree

> also
> 
> if(new_val + 32768U > 65537U)
> might be faster ...

Yes, but is less readable...

-Vitor




More information about the ffmpeg-cvslog mailing list