libm: Add fallback definition for cbrt() using pow()
authorJames Almer <jamrial@gmail.com>
Tue, 22 Jan 2013 07:10:21 +0000 (04:10 -0300)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 22 Jan 2013 15:02:31 +0000 (16:02 +0100)
The function is known to be missing in at least one target (MSVC).

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
configure
libavutil/libm.h

index 8460e5f..a741fc3 100755 (executable)
--- a/configure
+++ b/configure
@@ -1300,6 +1300,7 @@ HAVE_LIST_PUB='
 MATH_FUNCS="
     atanf
     atan2f
+    cbrt
     cbrtf
     cosf
     exp2
index bfcc21c..6c17b28 100644 (file)
 #define powf(x, y) ((float)pow(x, y))
 #endif
 
+#if !HAVE_CBRT
+static av_always_inline double cbrt(double x)
+{
+    return x < 0 ? -pow(-x, 1.0 / 3.0) : pow(x, 1.0 / 3.0);
+}
+#endif
+
 #if !HAVE_CBRTF
 static av_always_inline float cbrtf(float x)
 {