[MPlayer-dev-eng] [PATCH] Yet another batch of warning fixes :->
Anders Johansson
ajh at watri.uwa.edu.au
Tue Dec 10 10:56:54 CET 2002
Hi,
> Hi,
>
> > > > #define ADDQUE(xi,xq,in)\
> > > > xq[xi]=xq[xi+L]=(*in);\
> > > > - xi=(--xi)&(L-1);
> > > > + xi=(xi-1)&(L-1);\
> > > > + xi--;
> > >
> > > why?
> >
> > He's correct that something's wrong here. Read the comp.lang.c faq.
> > The result of an expression similar to x=--x; is undefined. I have no
> ah. you're right
> but then, that extra xi--; is unneeded and wrong
>
> so, the right fix would be:
> - xi=(--xi)&(L-1);
> + xi=(xi-1)&(L-1);
>
> IMHO, Anders should confirm.
It is the index for a circular buffer, the sulution Arpi suggests
should work fine, but I haven't got time to test it right now.
> > > > register int16_t* end = in+ao_plugin_data.len/2;
> > > > - while(in < end) *in=(*in++)>>1;
> > > > + while(in < end) { *in=(*in)>>1; in++; }
> > >
> > > again, why?
> >
> > Same deal.
>
> yes, but the fix is wrong.
> it should be (IMHO!) *(++in)=(*in)>>1; or *(in+1)=*in>>1;++in;
>
> IMHO the order that gcc (and other compilers) use is calculating the
> rightvalue first, then storing the result in the left value.
use:
while(in < end) { *in=(*in)>>1; in++;}
>
> A'rpi / Astral & ESP-team
>
//Anders
More information about the MPlayer-dev-eng
mailing list