blob: 428f518129c338d98cae7b49fb78b78c5ef699e9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#ifndef AL_MATH_DEFS_H
#define AL_MATH_DEFS_H
#include <math.h>
#ifdef HAVE_FLOAT_H
#include <float.h>
#endif
#define F_PI (3.14159265358979323846f)
#define F_PI_2 (1.57079632679489661923f)
#define F_TAU (6.28318530717958647692f)
#ifndef FLT_EPSILON
#define FLT_EPSILON (1.19209290e-07f)
#endif
#ifndef HUGE_VALF
static const union msvc_inf_hack {
unsigned char b[4];
float f;
} msvc_inf_union = {{ 0x00, 0x00, 0x80, 0x7F }};
#define HUGE_VALF (msvc_inf_union.f)
#endif
#ifndef HAVE_LOG2F
static inline float log2f(float f)
{
return logf(f) / logf(2.0f);
}
#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))
#endif /* AL_MATH_DEFS_H */
|