[FFmpeg-cvslog] lavu/libm: add isfinite fallback

Ganesh Ajjanagadde git at videolan.org
Thu Jan 14 02:07:42 CET 2016


ffmpeg | branch: master | Ganesh Ajjanagadde <gajjanagadde at gmail.com> | Wed Jan 13 19:09:25 2016 -0500| [a0a47a09b0e204216072c1f77643de3f6f869732] | committer: Ganesh Ajjanagadde

lavu/libm: add isfinite fallback

Reviewed-by: Ronald S. Bultje <rsbultje at gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a0a47a09b0e204216072c1f77643de3f6f869732
---

 configure        |    1 +
 libavutil/libm.h |   19 +++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/configure b/configure
index 6d14d37..28ec5bf 100755
--- a/configure
+++ b/configure
@@ -1820,6 +1820,7 @@ MATH_FUNCS="
     exp2f
     expf
     hypot
+    isfinite
     isinf
     isnan
     ldexpf
diff --git a/libavutil/libm.h b/libavutil/libm.h
index bc44dca..a819962 100644
--- a/libavutil/libm.h
+++ b/libavutil/libm.h
@@ -343,6 +343,25 @@ static av_always_inline av_const int avpriv_isnan(double x)
         : avpriv_isnan(x))
 #endif /* HAVE_ISNAN */
 
+#if !HAVE_ISFINITE
+static av_always_inline av_const int avpriv_isfinitef(float x)
+{
+    uint32_t v = av_float2int(x);
+    return (v & 0x7f800000) != 0x7f800000;
+}
+
+static av_always_inline av_const int avpriv_isfinite(double x)
+{
+    uint64_t v = av_double2int(x);
+    return (v & 0x7ff0000000000000) != 0x7ff0000000000000;
+}
+
+#define isfinite(x)                  \
+    (sizeof(x) == sizeof(float)      \
+        ? avpriv_isfinitef(x)        \
+        : avpriv_isfinite(x))
+#endif /* HAVE_ISFINITE */
+
 #if !HAVE_HYPOT
 static inline av_const double hypot(double x, double y)
 {



More information about the ffmpeg-cvslog mailing list