[FFmpeg-devel] [PATCH] Add ceil(log2(x)) to libavutil/common.h

Diego Biurrun diego
Mon Aug 24 11:59:11 CEST 2009


On Sun, Aug 23, 2009 at 07:14:42PM +0200, Thilo Borgmann wrote:
> Revision 2 attached.
> 
> --- libavutil/common.h	(revision 19682)
> +++ libavutil/common.h	(working copy)
> @@ -225,6 +225,14 @@
>  
> +/** Computes ceil(log2(x)).
> + * @param x value used to compute ceil(log2(x))
> + * @return computed ceiling of log2(x)
> + */
> +static inline av_const int av_ceil_log2(int x) {
> +    return x - 1 ? av_log2((x - 1) << 1) : 0;
> +}

Format this in K&R style please.  You should not just disregard what the
surrounding code looks like when you edit a file.

Diego



More information about the ffmpeg-devel mailing list