[FFmpeg-devel] [PATCH] Bugfix: decoding 8- and 24-bit FLAC files

Michael Donaghy md401
Tue Jun 12 16:43:35 CEST 2007


On Tuesday 12 June 2007 12:56:08 Benoit Fouet wrote:

> >>>>> +                *(samples++) = (left  << (24 - s->bps)) >> 8;\
> >>>>> +                *(samples++) = (right << (24 - s->bps)) >> 8;\
> >>>>
> >>>> i think this code lacks paretheses
> >>>
> >>> I think it has too many.
> >>
> >> ok, what i'd write would be:
> >> *samples++ = ((left) << 24 - s->bps) >> 8;\
> >>
> >> is that ok ?
> >
> > iam fine with it though maybe we should keep the one around 24 - s->bps
> > but thats just a slight personal preferance ...
>
> ok, then i'll just add the one around "left" and "right" if it's ok
> and maybe remove all parentheses around "samples"
>
I wrote it the way I prefer to parenthesise it; I feel that *(samples++) makes 
it more clear that it is the pointer rather than the target which is being 
incremented, and likewise left << (24 - s->bps) makes it clear this is not 
doing (left << 24) - s->bps, whereas ((left)  << (24 - s->bps)) seems no less 
ambiguous than (left  << (24 - s->bps)) to my eyes. But shrug, I care far 
less about the parenthesising than I do about the ability to play 24-bit 
flacs.

Michael





More information about the ffmpeg-devel mailing list