foo
[dos_low3d] / src / util.h
1 #ifndef UTIL_H_
2 #define UTIL_H_
3
4 #include "types.h"
5
6 #define SINLUT_SIZE             512
7 #define SINLUT_MASK             (SINLUT_SIZE - 1)
8 #define SINLUT_SCALE    8192
9
10 extern int16_t sintab[];
11
12 /* sin(x) lookup -> 16.16 fixed point */
13 #define XSIN(x) (sintab[(x) & SINLUT_MASK] << 3)
14 #define XCOS(x) (sintab[((x) + SINLUT_SIZE / 4) & SINLUT_MASK] << 3)
15
16 /* perform x * s / d without loss of precision */
17 int32_t muldiv(int32_t x, int32_t s, int32_t d);
18 #pragma aux muldiv = \
19         "imul ebx" \
20         "idiv ecx" \
21         parm [eax] [ebx] [ecx] \
22         value [eax] \
23         modify [eax edx];
24
25 #endif  /* UTIL_H_ */