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

Reimar Döffinger Reimar.Doeffinger
Sat Feb 28 17:23:59 CET 2009


On Sat, Feb 28, 2009 at 04:53:08PM +0100, Stefano Sabatini wrote:
> Hi,
> as in subject, regards.
> -- 
> FFmpeg = Funny and Forgiving Multimedia Pitiful Elected Ghost

> Index: libavutil/mathematics.h
> ===================================================================
> --- libavutil/mathematics.h	(revision 17629)
> +++ libavutil/mathematics.h	(working copy)
> @@ -50,6 +50,9 @@
>      AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero.
>  };
>  
> +/**
> + * Returns the greatest common divisor of a and b.
> + */

Two more things should be mentioned:
0 is considered to be dividable by anything, if one or both of a and b
are negative, there are no guarantees on the sign of the result.
(the later part could be fixed easily, though it would be a bit ugly
without first converting it into a non-recursive function - note that
gcc already converts this function into a non-recursive one during
compilation).




More information about the ffmpeg-devel mailing list