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

Reimar Döffinger Reimar.Doeffinger
Sun Mar 1 23:19:28 CET 2009


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.




More information about the ffmpeg-devel mailing list