aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/math_defs.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/common/math_defs.h b/common/math_defs.h
index 04d73f42..99cc62ec 100644
--- a/common/math_defs.h
+++ b/common/math_defs.h
@@ -40,6 +40,19 @@ static inline float cbrtf(float f)
}
#endif
+#ifndef HAVE_COPYSIGNF
+static inline float copysignf(float x, float y)
+{
+ union {
+ float f;
+ unsigned int u;
+ } ux = { x }, uy = { y };
+ ux.u &= 0x7fffffffu;
+ ux.u |= (uy.u&0x80000000u);
+ return ux.f;
+}
+#endif
+
#define DEG2RAD(x) ((float)(x) * (float)(M_PI/180.0))
#define RAD2DEG(x) ((float)(x) * (float)(180.0/M_PI))