aboutsummaryrefslogtreecommitdiffstats
path: root/common/math_defs.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-06-29 10:11:31 -0700
committerChris Robinson <[email protected]>2017-06-29 10:11:31 -0700
commita69d608a1ec38e6afd903224e86c0bf29b8d0623 (patch)
tree449efe96be44689d54c0b1fb228bb181cbbac9c5 /common/math_defs.h
parentaefa11b6adf3bdd0e82d2c2f125d2bd62288e246 (diff)
Define a backup log2f if the compiler doesn't have it
Diffstat (limited to 'common/math_defs.h')
-rw-r--r--common/math_defs.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/common/math_defs.h b/common/math_defs.h
index 1b394976..cbe9091f 100644
--- a/common/math_defs.h
+++ b/common/math_defs.h
@@ -22,6 +22,13 @@ static const union msvc_inf_hack {
#define HUGE_VALF (msvc_inf_union.f)
#endif
+#ifndef HAVE_LOG2F
+static inline float log2f(float f)
+{
+ return logf(f) / logf(2.0f);
+}
+#endif
+
#define DEG2RAD(x) ((float)(x) * (F_PI/180.0f))
#define RAD2DEG(x) ((float)(x) * (180.0f/F_PI))