Martin Storsjö <[email protected]> writes: > From: "Ronald S. Bultje" <[email protected]> > > Add fallback implementations if they don't exist. > --- > configure | 4 ++++ > libavutil/libm.h | 10 ++++++++++ > 2 files changed, 14 insertions(+) > > diff --git a/configure b/configure > index 06bf2c0..a19b5f9 100755 > --- a/configure > +++ b/configure > @@ -1094,6 +1094,8 @@ HAVE_LIST=" > inet_aton > inline_asm > isatty > + isinf > + isnan > jack_port_get_latency_range > ldbrx > libdc1394_1 > @@ -2922,6 +2924,8 @@ enabled vaapi && require vaapi va/va.h vaInitialize -lva > check_mathfunc cbrtf > check_mathfunc exp2 > check_mathfunc exp2f > +check_mathfunc isnan > +check_mathfunc isinf > check_mathfunc llrint > check_mathfunc llrintf > check_mathfunc log2 > diff --git a/libavutil/libm.h b/libavutil/libm.h > index b4d5af0..6d51271 100644 > --- a/libavutil/libm.h > +++ b/libavutil/libm.h > @@ -42,6 +42,16 @@ > #define exp2f(x) ((float)exp2(x)) > #endif /* HAVE_EXP2F */ > > +#if !HAVE_ISNAN > +#undef isnan > +#define isnan(x) ((x) != (x)) > +#endif /* HAVE_ISNAN */ > + > +#if !HAVE_ISINF > +#undef isinf > +#define isinf(x) ((x) * 2 == (x) && (x) != 0) > +#endif /* HAVE_ISINF */
These are not good. If x is a signalling NaN or x*2 overflows, there will be trouble. A better solution is to use av_int2float() and test for the inf/nan bit patterns explicitly. -- Måns Rullgård [email protected] _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
