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

Ronald S. Bultje rsbultje at gmail.com
Thu Jan 14 02:07:14 CET 2016


Hi,

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

> On Wed, Jan 13, 2016 at 7:39 PM, Ronald S. Bultje <rsbultje at gmail.com>
> wrote:
> > 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.
>
> isfinite is a macro, not a function (man isfinite). Your point is
> still valid though, really it should do a sizeof first (dbl/float),
> then call a avpriv_isfinitef, avpriv_isfinite. I was being lazy.


Does type matter much? Afaik, inf/nan will be maintained between
float/double/long double.

Ronald


More information about the ffmpeg-devel mailing list