Subversion Repositories Games.Carmageddon

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 pmbaty 1
#ifndef _FIXED_H_
2
#define _FIXED_H_
3
 
4
#include "brender/br_types.h"
5
#include "brender/br_inline_funcs.h"
6
 
7
#define BR_ONE_LU ((br_fixed_lu)0x00010000)
8
#define BR_ONE_LSF ((br_fixed_ls)0x00008000)
9
#define BR_ONE_LUF ((br_fixed_lu)0x00010000)
10
#define BR_ONE_SS ((br_fixed_ss)0x0100)
11
#define BR_ONE_SU ((br_fixed_ss)0x0100)
12
#define BR_ONE_SSF ((br_fixed_ss)0x0080)
13
#define BR_ONE_SUF ((br_fixed_ss)0x0100)
14
#define BrIntToFixed(i) ((br_fixed_ls)(((unsigned)(i))<<16))
15
#define BrFloatToFixed(f) ((br_fixed_ls)((f)*65536.f))
16
#define BrFixedToInt(i) ((i)>>16)
17
//#define BrFixedToFloat(i) ((float)((i)*(1.f/65536.f)))
18
 
19
#define BrFloatToFixedFraction(f) ((br_fixed_lsf)((f)*32768.f))
20
#define BrFixedFractionToFloat(f) ((float)(((br_fixed_lsf)(f))*(1.f/32768.f)))
21
 
22
#define BrFloatToFixedUFraction(f) ((br_fixed_luf)((f)*65536.f))
23
#define BrFixedUFractionToFloat(f) ((float)(((br_fixed_luf)(f))*(1.f/65536.f)))
24
 
25
#if 1
26
#define BrFloatToScalar(f) f
27
#define BrScalarToFlat(f) f
28
#define BrFixedToScalar BrFixedToFloat
29
#define BrScalarToFixed BrFloatToFixed
30
 
31
#define BrScalarToFraction(f) f
32
#define BrFractionToScalar(f) f
33
#endif
34
 
35
br_fixed_ls BrFixedAbs(br_fixed_ls a);
36
 
37
br_fixed_ls BrFixedMul(br_fixed_ls a, br_fixed_ls b);
38
 
39
br_fixed_ls BrFixedMac2(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d);
40
 
41
br_fixed_ls BrFixedMac3(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d, br_fixed_ls e, br_fixed_ls f);
42
 
43
br_fixed_ls BrFixedMac4(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d, br_fixed_ls e, br_fixed_ls f, br_fixed_ls g, br_fixed_ls h);
44
 
45
br_fixed_ls BrFixedLength2(br_fixed_ls a, br_fixed_ls b);
46
 
47
br_fixed_ls BrFixedLength3(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c);
48
 
49
br_fixed_ls BrFixedLength4(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d);
50
 
51
br_fixed_ls BrFixedRLength2(br_fixed_ls a, br_fixed_ls b);
52
 
53
br_fixed_ls BrFixedRLength3(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c);
54
 
55
br_fixed_ls BrFixedRLength4(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d);
56
 
57
br_fixed_ls BrFixedDiv(br_fixed_ls a, br_fixed_ls b);
58
 
59
br_fixed_ls BrFixedDivR(br_fixed_ls a, br_fixed_ls b);
60
 
61
br_fixed_ls BrFixedDivF(br_fixed_ls a, br_fixed_ls b);
62
 
63
br_fixed_ls BrFixedMulDiv(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c);
64
 
65
br_fixed_ls BrFixedMac2Div(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d, br_fixed_ls e);
66
 
67
br_fixed_ls BrFixedMac3Div(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d, br_fixed_ls e, br_fixed_ls f, br_fixed_ls g);
68
 
69
br_fixed_ls BrFixedMac4Div(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d, br_fixed_ls e, br_fixed_ls f, br_fixed_ls g, br_fixed_ls h, br_fixed_ls i);
70
 
71
br_fixed_ls BrFixedFMac2(br_fixed_lsf a, br_fixed_ls b, br_fixed_lsf c, br_fixed_ls d);
72
 
73
br_fixed_ls BrFixedFMac3(br_fixed_lsf a, br_fixed_ls b, br_fixed_lsf c, br_fixed_ls d, br_fixed_lsf e, br_fixed_ls f);
74
 
75
br_fixed_ls BrFixedFMac4(br_fixed_lsf a, br_fixed_ls b, br_fixed_lsf c, br_fixed_ls d, br_fixed_lsf e, br_fixed_ls f, br_fixed_lsf g, br_fixed_ls h);
76
 
77
br_fixed_ls BrFixedRcp(br_fixed_ls a);
78
 
79
br_fixed_ls BrFixedSqr(br_fixed_ls a);
80
 
81
br_fixed_ls BrFixedSqr2(br_fixed_ls a, br_fixed_ls b);
82
 
83
br_fixed_ls BrFixedSqr3(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c);
84
 
85
br_fixed_ls BrFixedSqr4(br_fixed_ls a, br_fixed_ls b, br_fixed_ls c, br_fixed_ls d);
86
 
87
br_fixed_ls BrFixedSin(br_angle a);
88
 
89
br_fixed_ls BrFixedCos(br_angle a);
90
 
91
br_angle BrFixedASin(br_fixed_ls a);
92
 
93
br_angle BrFixedACos(br_fixed_ls a);
94
 
95
br_angle BrFixedATan2(br_fixed_ls x, br_fixed_ls y);
96
 
97
br_angle BrFixedATan2Fast(br_fixed_ls x, br_fixed_ls y);
98
 
99
br_uint_16 _BrISqrt32(br_uint_32 a);
100
 
101
br_uint_32 _BrISqrt64(uint64_t a);
102
 
103
br_uint_16 _BrFastSqrt32(br_uint_32 v);
104
 
105
br_uint_32 _BrFastRSqrt32(br_uint_32 v);
106
 
107
br_uint_32 _BrFastRSqrt64(uint64_t v);
108
 
109
#endif