[FFmpeg-devel] [PATCH] Document av_gcd()

Stefano Sabatini stefano.sabatini-lala
Mon Mar 2 00:17:15 CET 2009


On date Sunday 2009-03-01 23:19:28 +0100, Reimar D?ffinger encoded:
> On Sun, Mar 01, 2009 at 11:10:33PM +0100, Stefano Sabatini wrote:
> > > The you'd have to flip the usage in utils.c though, it uses
> > > av_gcd(0, a) (I considered speed irrelevant there).
> > 
> > Yes, but it's not always a speed concern (av_gcd(0, N) requires two
> > recursive calls), according to ISO/IEC 9899:1999:
> > 
> > 5 The result of the / operator is the quotient from the division of the first operand by the
> >   second; the result of the % operator is the remainder. In both operations, if the value of
> >   the second operand is zero, the behavior is undefined.
> > 
> > That means that currently the behavior of av_gcd(0, N) is undefined.
> 
> Read the code again.

Yes I've got confused.

And still I wonder if it makes sense to specify this behaviour, and if
supporting this case would make an eventual optimization hader...

Regards.
-- 
FFmpeg = Faithful and Faboulous Mean Practical Entertaining Gargoyle




More information about the ffmpeg-devel mailing list