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

Michael Niedermayer michaelni
Mon Aug 24 12:09:56 CEST 2009


On Mon, Aug 24, 2009 at 11:59:11AM +0200, Diego Biurrun wrote:
> 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.

may i suggest
static inline av_const int av_ceil_log2(int x)
{
    return av_log2((x - 1) << 1);
}


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090824/fc4fb840/attachment.pgp>



More information about the ffmpeg-devel mailing list