aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorGanesh Ajjanagadde <gajjanagadde@gmail.com>2016-01-13 19:09:25 -0500
committerGanesh Ajjanagadde <gajjanagadde@gmail.com>2016-01-13 20:00:19 -0500
commita0a47a09b0e204216072c1f77643de3f6f869732 (patch)
tree52ce2f15227c7f9ce359b75f7f349fef2736f0b1 /libavutil
parent44ac13eed49593f4f8efdb72ab0d5b48e05aa305 (diff)
downloadffmpeg-a0a47a09b0e204216072c1f77643de3f6f869732.tar.gz
lavu/libm: add isfinite fallback
Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/libm.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/libavutil/libm.h b/libavutil/libm.h
index bc44dcab0f..a819962391 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)
{