[FFmpeg-cvslog] r13277 - trunk/libavcodec/ra144.c
Michael Niedermayer
michaelni
Sat May 24 14:04:11 CEST 2008
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 ...
of course x is a bad name
new_val would be better
also
if(new_val + 32768U > 65537U)
might be faster ...
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20080524/870dedfe/attachment.pgp>
More information about the ffmpeg-cvslog
mailing list