aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/imports.h
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2010-08-13 20:18:08 -0700
committerIan Romanick <[email protected]>2010-08-13 20:18:08 -0700
commit2f8ee757ab324d599fcb8287789eb5f1a7890d74 (patch)
tree157ea3d2d400b0c706f79aa656ba224095783462 /src/mesa/main/imports.h
parent9364ad8528b8482afd01aab9b5ebe8c9176883df (diff)
mesa: Work-arounds for platforms that lack C99 math functions
Diffstat (limited to 'src/mesa/main/imports.h')
-rw-r--r--src/mesa/main/imports.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index 9c2ffd66d69..846a9a0faf4 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -116,6 +116,34 @@ typedef union { GLfloat f; GLint i; } fi_type;
#endif
+/**
+ * \name Work-arounds for platforms that lack C99 math functions
+ */
+/*@{*/
+#if (_XOPEN_SOURCE < 600) && !defined(_ISOC99_SOURCE) \
+ && (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L))
+#define acosf(f) ((float) acos(f))
+#define asinf(f) ((float) asin(f))
+#define atan2f(f) ((float) atan2(f))
+#define atanf(f) ((float) atan(f))
+#define cielf(f) ((float) ciel(f))
+#define cosf(f) ((float) cos(f))
+#define coshf(f) ((float) cosh(f))
+#define expf(f) ((float) exp(f))
+#define exp2f(f) ((float) exp2(f))
+#define floorf(f) ((float) floor(f))
+#define logf(f) ((float) log(f))
+#define log2f(f) ((float) log2(f))
+#define powf(f) ((float) pow(f))
+#define sinf(f) ((float) sin(f))
+#define sinhf(f) ((float) sinh(f))
+#define sqrtf(f) ((float) sqrt(f))
+#define tanf(f) ((float) tan(f))
+#define tanhf(f) ((float) tanh(f))
+#define truncf(f) ((float) trunc(f))
+#endif
+/*@}*/
+
/***
*** LOG2: Log base 2 of float
***/