Commit 46df708b authored by Martin Storsjö's avatar Martin Storsjö

libm: Provide fallback definitions for isnan() and isinf()

Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
parent ef882e46
...@@ -1093,6 +1093,8 @@ HAVE_LIST=" ...@@ -1093,6 +1093,8 @@ HAVE_LIST="
inet_aton inet_aton
inline_asm inline_asm
isatty isatty
isinf
isnan
jack_port_get_latency_range jack_port_get_latency_range
ldbrx ldbrx
libdc1394_1 libdc1394_1
...@@ -2922,6 +2924,8 @@ enabled vaapi && require vaapi va/va.h vaInitialize -lva ...@@ -2922,6 +2924,8 @@ enabled vaapi && require vaapi va/va.h vaInitialize -lva
check_mathfunc cbrtf check_mathfunc cbrtf
check_mathfunc exp2 check_mathfunc exp2
check_mathfunc exp2f check_mathfunc exp2f
check_mathfunc isinf
check_mathfunc isnan
check_mathfunc llrint check_mathfunc llrint
check_mathfunc llrintf check_mathfunc llrintf
check_mathfunc log2 check_mathfunc log2
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <math.h> #include <math.h>
#include "config.h" #include "config.h"
#include "attributes.h" #include "attributes.h"
#include "intfloat.h"
#if !HAVE_CBRTF #if !HAVE_CBRTF
static av_always_inline float cbrtf(float x) static av_always_inline float cbrtf(float x)
...@@ -45,6 +46,26 @@ 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)) #define exp2f(x) ((float)exp2(x))
#endif /* HAVE_EXP2F */ #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 #if !HAVE_LLRINT
#undef llrint #undef llrint
#define llrint(x) ((long long)rint(x)) #define llrint(x) ((long long)rint(x))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment