[FFmpeg-devel] [PATCH] Add the function libavcodec/utils.c:avcodec_type_string

Rich Felker dalias
Fri Nov 9 23:51:22 CET 2007


On Fri, Nov 09, 2007 at 11:57:57PM +0200, Balatoni Denes wrote:
> Hi!
> 
> Friday 09 November 2007 04:17-kor Michael Niedermayer ezt ?rta:
> > > char *avcodec_type_string (char *buf, int buf_size, enum CodecType
> > > codec_type) {
> > >     if (codec_type<0 || codec_type>CODEC_TYPE_NB)
> >
> > this can be simplified to 1 check with (unsigned)
> 
> Not a major point, but it seems gcc actually simplifies it automatically (at 
> least with O3). Even gcc 2.97 does the simplification for me.

Regardless it's nice to make it explicit that it's only one for anyone
reading the code. The code is also smaller textually that way.

Rich




More information about the ffmpeg-devel mailing list