libm: provide fallback definition for cbrtf() using powf()
This adds a fallback for cbrtf() using powf(x, 1/3). Since powf() with a non-integer exponent requires a non-negative base, special handling of negative inputs is needed. Signed-off-by: Mans Rullgard <mans@mansr.com>
This commit is contained in:
parent
4b1b1449d9
commit
153335625c
2
configure
vendored
2
configure
vendored
@ -1059,6 +1059,7 @@ HAVE_LIST="
|
|||||||
asm_mod_y
|
asm_mod_y
|
||||||
attribute_may_alias
|
attribute_may_alias
|
||||||
attribute_packed
|
attribute_packed
|
||||||
|
cbrtf
|
||||||
closesocket
|
closesocket
|
||||||
cmov
|
cmov
|
||||||
dcbzl
|
dcbzl
|
||||||
@ -2918,6 +2919,7 @@ done
|
|||||||
check_lib math.h sin -lm && LIBM="-lm"
|
check_lib math.h sin -lm && LIBM="-lm"
|
||||||
enabled vaapi && require vaapi va/va.h vaInitialize -lva
|
enabled vaapi && require vaapi va/va.h vaInitialize -lva
|
||||||
|
|
||||||
|
check_mathfunc cbrtf
|
||||||
check_mathfunc exp2
|
check_mathfunc exp2
|
||||||
check_mathfunc exp2f
|
check_mathfunc exp2f
|
||||||
check_mathfunc llrint
|
check_mathfunc llrint
|
||||||
|
@ -28,6 +28,13 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "attributes.h"
|
#include "attributes.h"
|
||||||
|
|
||||||
|
#if !HAVE_CBRTF
|
||||||
|
static av_always_inline float cbrtf(float x)
|
||||||
|
{
|
||||||
|
return x < 0 ? -powf(-x, 1.0 / 3.0) : powf(x, 1.0 / 3.0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !HAVE_EXP2
|
#if !HAVE_EXP2
|
||||||
#undef exp2
|
#undef exp2
|
||||||
#define exp2(x) exp((x) * 0.693147180559945)
|
#define exp2(x) exp((x) * 0.693147180559945)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user