[FFmpeg-devel] [PATCH] djgpp port

Rich Felker dalias
Mon Dec 24 15:00:48 CET 2007


On Mon, Dec 24, 2007 at 02:24:09PM +0300, Michael Kostylev wrote:
> diff -ur ffmpeg-export-2007-12-23/libavutil/internal.h ffmpeg-export-2007-12-23_djgpp/libavutil/internal.h
> --- ffmpeg-export-2007-12-23/libavutil/internal.h	2007-11-19 13:40:11.000000000 +0300
> +++ ffmpeg-export-2007-12-23_djgpp/libavutil/internal.h	2007-12-24 13:21:25.000000000 +0300
> @@ -276,8 +276,36 @@
>  /* btw, rintf() is existing on fbsd too -- alex */
>  static av_always_inline long int lrintf(float x)
>  {
> -    return (int)(rint(x));
> +    return (long int)(rint(x));
>  }
>  #endif /* HAVE_LRINTF */
>  
> +#ifndef HAVE_LLRINT
> +static av_always_inline long long llrint(double x)
> +{
> +    return (long long)(rint(x));
> +}
> +#endif /* HAVE_LLRINT */
> +
> +#ifndef HAVE_LRINT
> +static av_always_inline long int lrint(double x)
> +{
> +    return (long int)(rint(x));
> +}
> +#endif /* HAVE_LRINT */
> +
> +#ifndef HAVE_ROUND
> +static av_always_inline double round(double x)
> +{
> +    return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5);
> +}
> +#endif /* HAVE_ROUND */
> +
> +#ifndef HAVE_ROUNDF
> +static av_always_inline float roundf(float x)
> +{
> +    return (float)((x > 0) ? floor(x + 0.5) : ceil(x - 0.5));
> +}
> +#endif /* HAVE_ROUNDF */

Casts like this are ugly and unnecessary. The return statement already
casts to the correct sized type. C is not C++.

Rich




More information about the ffmpeg-devel mailing list