aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-02-06 02:35:08 -0800
committerChris Robinson <[email protected]>2018-02-06 02:35:08 -0800
commitf5f996c14a7d7c46f0967eee01af9b6b77caa4a7 (patch)
treebfa4a5f0fbf7325ca7037417784abe785a1720f0
parentda1ee3baba32e3a2525d90e97e172965d4f90287 (diff)
Check for a cbrtf function
-rw-r--r--CMakeLists.txt1
-rw-r--r--common/math_defs.h7
-rw-r--r--config.h.in3
3 files changed, 11 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5d665e72..17f561f2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -510,6 +510,7 @@ CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE__ALIGNED_MALLOC)
CHECK_SYMBOL_EXISTS(lrintf math.h HAVE_LRINTF)
CHECK_SYMBOL_EXISTS(modff math.h HAVE_MODFF)
CHECK_SYMBOL_EXISTS(log2f math.h HAVE_LOG2F)
+CHECK_SYMBOL_EXISTS(cbrtf math.h HAVE_CBRTF)
IF(HAVE_FLOAT_H)
CHECK_SYMBOL_EXISTS(_controlfp float.h HAVE__CONTROLFP)
diff --git a/common/math_defs.h b/common/math_defs.h
index cbe9091f..428f5181 100644
--- a/common/math_defs.h
+++ b/common/math_defs.h
@@ -29,6 +29,13 @@ static inline float log2f(float f)
}
#endif
+#ifndef HAVE_CBRTF
+static inline float cbrtf(float f)
+{
+ return powf(f, 1.0f/3.0f);
+}
+#endif
+
#define DEG2RAD(x) ((float)(x) * (F_PI/180.0f))
#define RAD2DEG(x) ((float)(x) * (180.0f/F_PI))
diff --git a/config.h.in b/config.h.in
index 8ef9057a..2abeedfd 100644
--- a/config.h.in
+++ b/config.h.in
@@ -89,6 +89,9 @@
/* Define if we have the log2f function */
#cmakedefine HAVE_LOG2F
+/* Define if we have the cbrtf function */
+#cmakedefine HAVE_CBRTF
+
/* Define if we have the strtof function */
#cmakedefine HAVE_STRTOF