[FFmpeg-devel] [PATCH] lavu/libm: add isfinite fallback

Ronald S. Bultje rsbultje at gmail.com
Thu Jan 14 01:39:20 CET 2016


Hi,

On Wed, Jan 13, 2016 at 7:10 PM, Ganesh Ajjanagadde <gajjanagadde at gmail.com>
wrote:

> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> ---
>  configure        | 1 +
>  libavutil/libm.h | 4 ++++
>  2 files changed, 5 insertions(+)
>
> diff --git a/configure b/configure
> index 415d939..a3aaa25 100755
> --- a/configure
> +++ b/configure
> @@ -1821,6 +1821,7 @@ MATH_FUNCS="
>      exp2f
>      expf
>      hypot
> +    isfinite
>      isinf
>      isnan
>      ldexpf
> diff --git a/libavutil/libm.h b/libavutil/libm.h
> index bc44dca..f01e5c6 100644
> --- a/libavutil/libm.h
> +++ b/libavutil/libm.h
> @@ -343,6 +343,10 @@ static av_always_inline av_const int
> avpriv_isnan(double x)
>          : avpriv_isnan(x))
>  #endif /* HAVE_ISNAN */
>
> +#if !HAVE_ISFINITE
> +#define isfinite(x) (!(isinf(x) || isnan(x)))
> +#endif /* HAVE_ISFINITE */


This will break if you use isfinite(*ptr++) or something obscure like that.
I'd make it an inline function. Otherwise I think it's fine.

Thanks,
Ronald


More information about the ffmpeg-devel mailing list