[FFmpeg-cvslog] libm: Provide fallback definitions for isnan() and isinf()
Martin Storsjö
git at videolan.org
Thu Jun 28 01:09:05 CEST 2012
ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Tue Jun 26 19:22:12 2012 +0300| [46df708b45b34191973ef5181b052ce8e583bb4e] | committer: Martin Storsjö
libm: Provide fallback definitions for isnan() and isinf()
Signed-off-by: Martin Storsjö <martin at martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=46df708b45b34191973ef5181b052ce8e583bb4e
---
configure | 4 ++++
libavutil/libm.h | 21 +++++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/configure b/configure
index 473393a..4a03846 100755
--- a/configure
+++ b/configure
@@ -1093,6 +1093,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 isinf
+check_mathfunc isnan
check_mathfunc llrint
check_mathfunc llrintf
check_mathfunc log2
diff --git a/libavutil/libm.h b/libavutil/libm.h
index b6d8a94..b5821e8 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))
More information about the ffmpeg-cvslog
mailing list