summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2012-06-26 19:22:12 +0300
committerMartin Storsjö <martin@martin.st>2012-06-27 14:04:02 +0300
commit46df708b45b34191973ef5181b052ce8e583bb4e (patch)
tree45d52081abe82e712f9bb02d8a41e09883bfe21e /libavutil
parentef882e464ab270276f56c1088da646a8080b8460 (diff)
downloadffmpeg-46df708b45b34191973ef5181b052ce8e583bb4e.tar.gz
libm: Provide fallback definitions for isnan() and isinf()
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/libm.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/libavutil/libm.h b/libavutil/libm.h
index b6d8a94fce..b5821e8267 100644
--- a/libavutil/libm.h
+++ b/libavutil/libm.h
@@ -27,6 +27,7 @@
#include <math.h>
#include "config.h"
#include "attributes.h"
+#include "intfloat.h"
#if !HAVE_CBRTF
static av_always_inline float cbrtf(float x)
@@ -45,6 +46,26 @@ static av_always_inline float cbrtf(float x)
#define exp2f(x) ((float)exp2(x))
#endif /* HAVE_EXP2F */
+#if !HAVE_ISINF
+static av_always_inline av_const int isinf(float x)
+{
+ uint32_t v = av_float2int(x);
+ if ((v & 0x7f800000) != 0x7f800000)
+ return 0;
+ return !(v & 0x007fffff);
+}
+#endif /* HAVE_ISINF */
+
+#if !HAVE_ISNAN
+static av_always_inline av_const int isnan(float x)
+{
+ uint32_t v = av_float2int(x);
+ if ((v & 0x7f800000) != 0x7f800000)
+ return 0;
+ return v & 0x007fffff;
+}
+#endif /* HAVE_ISNAN */
+
#if !HAVE_LLRINT
#undef llrint
#define llrint(x) ((long long)rint(x))