SGDK
A free and open development kit for the Sega Mega Drive
Loading...
Searching...
No Matches
maths.h
Go to the documentation of this file.
1
10
11#ifndef _MATHS_H_
12#define _MATHS_H_
13
14
15
16// 1° step is enough for FIX16
17extern const fix16 trigtab_f16[90 + 1];
18// 0.25° step is ok for fix32
19extern const fix32 trigtab_f32[(90 * 4) + 1];
20
21extern const fix16 log2tab_f16[0x10000];
22extern const fix16 log10tab_f16[0x10000];
23extern const fix16 sqrttab_f16[0x10000];
24
25
26#ifndef PI
31#define PI 3.14159265358979323846
32#endif
33
34
35#define FIX16_INT_BITS 10
36#define FIX16_FRAC_BITS (16 - FIX16_INT_BITS)
37#define FIX16_INT_MASK (((1 << FIX16_INT_BITS) - 1) << FIX16_FRAC_BITS)
38#define FIX16_FRAC_MASK ((1 << FIX16_FRAC_BITS) - 1)
39
40#define FIX32_INT_BITS 22
41#define FIX32_FRAC_BITS (32 - FIX32_INT_BITS)
42#define FIX32_INT_MASK (((1 << FIX32_INT_BITS) - 1) << FIX32_FRAC_BITS)
43#define FIX32_FRAC_MASK ((1 << FIX32_FRAC_BITS) - 1)
44
45#define FASTFIX16_INT_BITS 8
46#define FASTFIX16_FRAC_BITS (16 - FASTFIX16_INT_BITS)
47#define FASTFIX16_INT_MASK (((1 << FASTFIX16_INT_BITS) - 1) << FASTFIX16_FRAC_BITS)
48#define FASTFIX16_FRAC_MASK ((1 << FASTFIX16_FRAC_BITS) - 1)
49
50#define FASTFIX32_INT_BITS 16
51#define FASTFIX32_FRAC_BITS (32 - FASTFIX32_INT_BITS)
52#define FASTFIX32_INT_MASK (((1 << FASTFIX32_INT_BITS) - 1) << FASTFIX32_FRAC_BITS)
53#define FASTFIX32_FRAC_MASK ((1 << FASTFIX32_FRAC_BITS) - 1)
54
62#define FIX16(value) ((fix16) ((value) * (1 << FIX16_FRAC_BITS)))
70#define FIX32(value) ((fix32) ((value) * (1 << FIX32_FRAC_BITS)))
71
79#define FASTFIX16(value) ((fastfix16) ((value) * (1 << FASTFIX16_FRAC_BITS)))
87#define FASTFIX32(value) ((fastfix32) ((value) * (1 << FASTFIX32_FRAC_BITS)))
88
94#define F16(value) FIX16(value)
100#define F32(value) FIX32(value)
106#define FF16(value) FASTFIX16(value)
112#define FF32(value) FASTFIX32(value)
113
114
115#define F16_PI ((fix16) F16(PI))
116#define F16_RAD_TO_DEG F16(57.29577951308232)
117
118#define F32_PI ((fix32) F32(PI))
119
120
121// 2D base structures
122
127typedef struct
128{
129 u16 x;
130 u16 y;
131} Vect2D_u16;
132
137typedef struct
138{
139 s16 x;
140 s16 y;
141} Vect2D_s16;
142
147typedef struct
148{
149 u32 x;
150 u32 y;
151} Vect2D_u32;
152
157typedef struct
158{
159 s32 x;
160 s32 y;
161} Vect2D_s32;
162
167typedef struct
168{
169 fix16 x;
170 fix16 y;
171} Vect2D_f16;
172
177typedef struct
178{
179 fix32 x;
180 fix32 y;
181} Vect2D_f32;
182
187typedef struct
188{
189 fastfix16 x;
190 fastfix16 y;
192
197typedef struct
198{
199 fastfix32 x;
200 fastfix32 y;
202
208typedef struct
209{
210 Vect2D_f16 a;
211 Vect2D_f16 b;
212} Mat2D_f16;
213
219typedef struct
220{
221 Vect2D_f32 a;
222 Vect2D_f32 b;
223} Mat2D_f32;
224
230typedef struct
231{
232 Vect2D_ff16 a;
233 Vect2D_ff16 b;
234} Mat2D_ff16;
235
241typedef struct
242{
243 Vect2D_ff32 a;
244 Vect2D_ff32 b;
245} Mat2D_ff32;
246
247// short alias
248
297
299// Basic math functions
301
306#define min(X, Y) (((X) < (Y))?(X):(Y))
307
312#define max(X, Y) (((X) > (Y))?(X):(Y))
313
318#define clamp(X, L, H) (min(max((X), (L)), (H)))
319
320#if (ENABLE_NEWLIB == 0)
325#define abs(X) (((X) < 0)?-(X):(X))
326#endif // ENABLE_NEWLIB
327
328
339u32 mulu(u16 op1, u16 op2);
350s32 muls(s16 op1, s16 op2);
362u16 divu(u32 op1, u16 op2);
374s16 divs(s32 op1, s16 op2);
385u16 modu(u32 op1, u16 op2);
396s16 mods(s32 op1, s16 op2);
397
410u32 divmodu(u32 op1, u16 op2);
423s32 divmods(s32 op1, s16 op2);
424
432u32 u16ToBCD(u16 value);
440u32 u32ToBCD(u32 value);
441
449u32 getNextPow2(u32 value);
460u16 getLog2(u32 value);
461
481u32 getApproximatedDistanceV(V2s32* v);
482
483
484#define distance_approx(dx, dy) _Pragma("GCC error \"This method is deprecated, use getApproximatedDistance(..) instead.\"")
485#define getApproximatedLog2(value) _Pragma("GCC error \"This method is deprecated, use FF32_getLog2Fast(..) instead.\"")
486#define getLog2Int(value) _Pragma("GCC error \"This method is deprecated, use getLog2(..) instead.\"")
487
488
490// Fix16 Fixed point math functions
492
497s16 F16_toInt(fix16 value);
502fix32 F16_toFix32(fix16 value);
517fix16 F16_frac(fix16 value);
522fix16 F16_int(fix16 value);
532fix16 F16_round(fix16 value);
538
543fix16 F16_mul(fix16 val1, fix16 val2);
548fix16 F16_div(fix16 val1, fix16 val2);
553fix16 F16_avg(fix16 val1, fix16 val2);
554
564fix16 F16_log10(fix16 value);
569fix16 F16_sqrt(fix16 value);
570
581fix16 F16_sin(fix16 angle);
586fix16 F16_cos(fix16 angle);
591fix16 F16_tan(fix16 angle);
602
609fix16 sinFix16(u16 value);
616fix16 cosFix16(u16 value);
617
632fix16 F16_getAngle(fix16 x1, fix16 y1, fix16 x2, fix16 y2);
651void F16_computePosition(fix16 *x2, fix16 *y2, fix16 x1, fix16 y1, fix16 ang, fix16 dist);
674void F16_computePositionEx(fix16 *x2, fix16 *y2, fix16 x1, fix16 y1, fix16 ang, fix16 dist, fix16 cosAdj, fix16 sinAdj);
675
676
677// Deprecated functions
678#define intToFix16(a) _Pragma("GCC error \"This method is deprecated, use FIX16(..) instead.\"")
679#define fix16ToInt(a) _Pragma("GCC error \"This method is deprecated, use F16_toInt(..) instead.\"")
680#define fix16ToFix32(a) _Pragma("GCC error \"This method is deprecated, use F16_toFix32(..) instead.\"")
681#define fix16Frac(a) _Pragma("GCC error \"This method is deprecated, use F16_frac(..) instead.\"")
682#define fix16Int(a) _Pragma("GCC error \"This method is deprecated, use F16_int(..) instead.\"")
683#define fix16Round(a) _Pragma("GCC error \"This method is deprecated, use F16_round(..) instead.\"")
684#define fix16ToRoundedInt(a) _Pragma("GCC error \"This method is deprecated, use F16_toRoundedInt(..) instead.\"")
685#define fix16Add(a, b) _Pragma("GCC error \"This method is deprecated, simply use '+' operator to add fix16 values together.\"")
686#define fix16Sub(a, b) _Pragma("GCC error \"This method is deprecated, simply use '-' operator to subtract fix16 values.\"")
687#define fix16Neg(a) _Pragma("GCC error \"This method is deprecated, simply use '0 - value' to get the negative fix16 value.\"")
688#define fix16Mul(a, b) _Pragma("GCC error \"This method is deprecated, use F16_mul(..) instead.\"")
689#define fix16Div(a, b) _Pragma("GCC error \"This method is deprecated, use F16_div(..) instead.\"")
690#define fix16Avg(a, b) _Pragma("GCC error \"This method is deprecated, use F16_avg(..) instead.\"")
691#define fix16Log2(a) _Pragma("GCC error \"This method is deprecated, use F16_log2(..) instead.\"")
692#define fix16Log10(a) _Pragma("GCC error \"This method is deprecated, use F16_log10(..) instead.\"")
693#define fix16Sqrt(a) _Pragma("GCC error \"This method is deprecated, use F16_sqrt(..) instead.\"")
694
695
697// Fix32 Fixed point math functions
699
704s32 F32_toInt(fix32 value);
709fix16 F32_toFix16(fix32 value);
724fix32 F32_frac(fix32 value);
729fix32 F32_int(fix32 value);
734fix32 F32_round(fix32 value);
740
746fix32 F32_mul(fix32 val1, fix32 val2);
752fix32 F32_div(fix32 val1, fix32 val2);
757fix32 F32_avg(fix32 val1, fix32 val2);
758
763fix32 F32_sin(fix16 angle);
768fix32 F32_cos(fix16 angle);
769
776fix32 sinFix32(u16 value);
783fix32 cosFix32(u16 value);
784
785
786// Deprecated functions
787#define intToFix32(a) _Pragma("GCC error \"This method is deprecated, use FIX32(..) instead.\"")
788#define fix32ToInt(a) _Pragma("GCC error \"This method is deprecated, use F32_toInt(..) instead.\"")
789#define fix32ToFix16(a) _Pragma("GCC error \"This method is deprecated, use F32_toFix16(..) instead.\"")
790#define fix32Frac(a) _Pragma("GCC error \"This method is deprecated, use F32_frac(..) instead.\"")
791#define fix32Int(a) _Pragma("GCC error \"This method is deprecated, use F32_int(..) instead.\"")
792#define fix32Round(a) _Pragma("GCC error \"This method is deprecated, use F32_round(..) instead.\"")
793#define fix32ToRoundedInt(a) _Pragma("GCC error \"This method is deprecated, use F32_toRoundedInt(..) instead.\"")
794#define fix32Add(a, b) _Pragma("GCC error \"This method is deprecated, simply use '+' operator to add fix32 values together.\"")
795#define fix32Sub(a, b) _Pragma("GCC error \"This method is deprecated, simply use '-' operator to subtract fix32 values.\"")
796#define fix32Neg(a) _Pragma("GCC error \"This method is deprecated, simply use '0 - value' to get the negative fix32 value.\"")
797#define fix32Mul(a, b) _Pragma("GCC error \"This method is deprecated, use F32_mul(..) instead.\"")
798#define fix32Div(a, b) _Pragma("GCC error \"This method is deprecated, use F32_div(..) instead.\"")
799#define fix32Avg(a, b) _Pragma("GCC error \"This method is deprecated, use F32_avg(..) instead.\"")
800
801
803// Fast Fix16 Fixed point math functions
805
846
857
858
859// Deprecated functions
860#define intToFastFix16(a) _Pragma("GCC error \"This method is deprecated, use FASTFIX16(..) instead.\"")
861#define fastFix16ToInt(a) _Pragma("GCC error \"This method is deprecated, use FF16_toInt(..) instead.\"")
862#define fastFix16Frac(a) _Pragma("GCC error \"This method is deprecated, use FF16_frac(..) instead.\"")
863#define fastFix16Int(a) _Pragma("GCC error \"This method is deprecated, use FF16_int(..) instead.\"")
864#define fastFix16Round(a) _Pragma("GCC error \"This method is deprecated, use FF16_round(..) instead.\"")
865#define fastFix16ToRoundedInt(a) _Pragma("GCC error \"This method is deprecated, use FF16_toRoundedInt(..) instead.\"")
866#define fastFix16Mul(a, b) _Pragma("GCC error \"This method is deprecated, use FF16_mul(..) instead.\"")
867#define fastFix16Div(a, b) _Pragma("GCC error \"This method is deprecated, use FF16_div(..) instead.\"")
868
869
871// Fast Fix32 Fixed point math functions
873
919
932
944
945
946// Deprecated functions
947#define intToFastFix32(a) _Pragma("GCC error \"This method is deprecated, use FASTFIX32(..) instead.\"")
948#define fastFix32ToInt(a) _Pragma("GCC error \"This method is deprecated, use FF32_toInt(..) instead.\"")
949#define fastFix32Frac(a) _Pragma("GCC error \"This method is deprecated, use FF32_frac(..) instead.\"")
950#define fastFix32Int(a) _Pragma("GCC error \"This method is deprecated, use FF32_int(..) instead.\"")
951#define fastFix32Round(a) _Pragma("GCC error \"This method is deprecated, use FF32_round(..) instead.\"")
952#define fastFix32ToRoundedInt(a) _Pragma("GCC error \"This method is deprecated, use FF32_toRoundedInt(..) instead.\"")
953#define fastFix32Mul(a, b) _Pragma("GCC error \"This method is deprecated, use FF32_mul(..) instead.\"")
954#define fastFix32Div(a, b) _Pragma("GCC error \"This method is deprecated, use FF32_div(..) instead.\"")
955
956
958// Vector2D base math functions
960
970
976
988void V2D_F16_movePoint(V2f16* pt, fix16 ang, fix16 dist);
1005void V2D_F16_movePointEx(V2f16* pt, fix16 ang, fix16 dist, fix16 cosAdj, fix16 sinAdj);
1006
1007
1008// Deprecated functions
1009#define getApproximatedDistanceV(dx, dy) _Pragma("GCC error \"This method is deprecated, use V2D_S32_getApproximatedDistance(..) instead.\"")
1010
1011#endif // _MATHS_H_
fix16 sinFix16(u16 value)
Compute sinus of specified value and return it as fix16. The input value is an integer defined as [0...
Definition maths.c:500
fastfix32 FF32_getLog2Fast(fastfix32 value)
Return a not accurate but fast log2 approximation of the specified value (fastfixed32) Ex: getLog2(F...
Definition maths.c:743
Vect2D_u32 V2u32
alias for Vect2D_u32
Definition maths.h:260
fastfix32 F16_toFastFix32(fix16 value)
Convert specified fix16 value to fastfix32.
Definition maths.c:301
fix16 F16_log10(fix16 value)
Compute and return the result of the Log10 of specified value (fix16).
Definition maths.c:353
void F16_computePosition(fix16 *x2, fix16 *y2, fix16 x1, fix16 y1, fix16 ang, fix16 dist)
Compute the new position of the point defined by (x1, y1) by moving it by the given 'distance' in the...
fix16 F16_cos(fix16 angle)
Compute cosinus of specified angle (in degree) and return it (fix16).
Definition maths.c:387
fastfix16 FF16_int(fastfix16 value)
Return integer part of the specified value (fastfix16).
Definition maths.c:650
fix32 F32_round(fix32 value)
Round the specified value to nearest integer (fix32).
Definition maths.c:552
u32 getNextPow2(u32 value)
Return next pow2 value which is greater than specified 32 bits unsigned value. Ex: getNextPow2(700) ...
Definition maths.c:210
void F16_computePositionEx(fix16 *x2, fix16 *y2, fix16 x1, fix16 y1, fix16 ang, fix16 dist, fix16 cosAdj, fix16 sinAdj)
Compute the new position of the point defined by (x1, y1) by moving it by the given 'distance' in the...
void V2D_F16_movePoint(V2f16 *pt, fix16 ang, fix16 dist)
Move the given point by the given 'distance' in the 'angle' direction.
Definition maths.c:839
Vect2D_ff16 V2ff16
alias for Vect2D_ff16
Definition maths.h:276
s32 F32_toRoundedInt(fix32 value)
Round and convert the specified fix32 value to integer.
Definition maths.c:557
fastfix16 FF16_div(fastfix16 val1, fastfix16 val2)
Compute and return the result of the division of val1 by val2 (fastfix16).
Definition maths.c:671
fastfix32 FF16_toFastFix32(fastfix16 value)
Convert fastfix16 to fastfix32.
Definition maths.c:640
fix32 F32_int(fix32 value)
Return integer part of the specified value (fix32).
Definition maths.c:547
u16 divu(u32 op1, u16 op2)
Direct divu instruction (unsigned 32/16=16:16) access using inline assembly to process op1/op2 operat...
Definition maths.c:106
s32 muls(s16 op1, s16 op2)
16x16=32 signed multiplication. Force GCC to use proper 68000 muls instruction.
Definition maths.c:81
Vect2D_f16 V2f16
alias for Vect2D_f16
Definition maths.h:268
u32 V2D_S32_getApproximatedDistance(V2s32 *v)
Return euclidean distance approximation for specified vector. The returned distance is not 100% perf...
Definition maths.c:828
s32 divmods(s32 op1, s16 op2)
Direct divs instruction (signed 32/16=16:16) access using inline assembly to process op1/op2 operatio...
Definition maths.c:158
fastfix32 FF32_mul(fastfix32 val1, fastfix32 val2)
Compute and return the result of the multiplication of val1 and val2 (fastfix32). WARNING: result ca...
Definition maths.c:726
s16 FF16_toRoundedInt(fastfix16 value)
Round and convert the specified fastfix16 value to integer (fastfix16).
Definition maths.c:660
Mat2D_ff16 M2ff16
alias for Mat2D_ff16
Definition maths.h:292
u32 u32ToBCD(u32 value)
Convert u32 to BCD.
Definition maths.c:195
fix32 F32_mul(fix32 val1, fix32 val2)
Compute and return the result of the multiplication of val1 and val2 (fix32). WARNING: result can ea...
Definition maths.c:563
u16 modu(u32 op1, u16 op2)
Direct divu instruction (unsigned 32/16=16:16) access using inline assembly.
Definition maths.c:126
fix16 F16_radianToDegree(fix16 radian)
Convert radian to degree (fix16)
Definition maths.c:449
fix16 F16_sin(fix16 angle)
Compute sinus of specified angle (in degree) and return it (fix16).
Definition maths.c:376
fix16 F16_div(fix16 val1, fix16 val2)
Compute and return the result of the division of val1 by val2 (fix16).
Definition maths.c:337
fix32 F32_avg(fix32 val1, fix32 val2)
Compute and return the result of the average of val1 by val2 (fix32).
Definition maths.c:579
fastfix32 F32_toFastFix32(fix32 value)
Convert specified fix32 value to fastfix32.
Definition maths.c:537
fastfix16 FF32_toFastFix16(fastfix32 value)
Convert fastfix32 to fastfix16.
Definition maths.c:701
fastfix32 FF32_fromInt(s16 value)
Convert integer to fastfix32.
Definition maths.c:681
fix16 V2D_F16_getAngle(V2f16 *pt1, V2f16 *pt2)
Compute and return the angle in degree (fix16) between the 2 points pt1 and pt2.
Definition maths.c:834
Vect2D_s16 V2s16
alias for Vect2D_s16
Definition maths.h:256
fix32 F16_toFix32(fix16 value)
Convert specified fix16 value to fix32.
Definition maths.c:291
s16 F16_toRoundedInt(fix16 value)
Round and convert the specified fix16 to integer.
Definition maths.c:326
s16 divs(s32 op1, s16 op2)
Direct divs instruction (signed 32/16=16:16) access using inline assembly to process op1/op2 operatio...
Definition maths.c:116
s16 FF32_toInt(fastfix32 value)
Convert fastfix32 to integer.
Definition maths.c:686
s32 FF32_toRoundedInt(fastfix32 value)
Round and convert the specified fastfix32 value to integer.
Definition maths.c:721
Mat2D_f32 M2f32
alias for Mat2D_f32
Definition maths.h:288
fix16 F16_int(fix16 value)
Return integer part of the specified value (fix16).
Definition maths.c:311
Vect2D_u16 V2u16
alias for Vect2D_u16
Definition maths.h:252
fix32 FF16_toFix32(fastfix16 value)
Convert fastfix16 to fix32.
Definition maths.c:635
fix16 F16_sqrt(fix16 value)
Compute and return the result of the root square of specified value (fix16).
Definition maths.c:358
fix16 F16_abs(fix16 x)
Return the absolute value of the specified value (fix16).
Definition maths.c:316
fix16 F32_toFix16(fix32 value)
Convert specified fix32 value to fix16.
Definition maths.c:527
s16 F16_toInt(fix16 value)
Convert fix16 to integer.
Definition maths.c:286
fix16 F16_mul(fix16 val1, fix16 val2)
Compute and return the result of the multiplication of val1 and val2 (fix16).
Definition maths.c:332
Mat2D_f16 M2f16
alias for Mat2D_f16
Definition maths.h:284
fix32 sinFix32(u16 value)
Compute sinus of specified value and return it as fix32. The input value is an integer defined as [0...
Definition maths.c:603
u16 getLog2(u32 value)
Return integer log2 of specified 32 bits unsigned value. Ex: getLog2Int(1024) = 10 getLog2Int(12345...
Definition maths.c:223
u32 getApproximatedDistance(s32 dx, s32 dy)
Return euclidean distance approximation for specified vector. The returned distance is not 100% perf...
Definition maths.c:253
fastfix16 FF16_mul(fastfix16 val1, fastfix16 val2)
Compute and return the result of the multiplication of val1 and val2 (fastfix16).
Definition maths.c:666
fastfix32 FF32_div(fastfix32 val1, fastfix32 val2)
Compute and return the result of the division of val1 by val2 (fastfix32). WARNING: result can easil...
Definition maths.c:734
fix16 F16_frac(fix16 value)
Return fractional part of the specified value (fix16).
Definition maths.c:306
fix32 F32_frac(fix32 value)
Return fractional part of the specified value (fix32).
Definition maths.c:542
fix32 F32_cos(fix16 angle)
Compute cosinus of specified angle (in degree) and return it as fix32.
Definition maths.c:596
s16 FF16_toInt(fastfix16 value)
Convert fastfix16 to integer.
Definition maths.c:625
u32 divmodu(u32 op1, u16 op2)
Direct divu instruction (unsigned 32/16=16:16) access using inline assembly to process op1/op2 operat...
Definition maths.c:148
u32 mulu(u16 op1, u16 op2)
16x16=32 unsigned multiplication. Force GCC to use proper 68000 mulu instruction.
Definition maths.c:76
fix32 FF32_toFix32(fastfix32 value)
Convert fastfix32 to fix32.
Definition maths.c:696
Vect2D_f32 V2f32
alias for Vect2D_f32
Definition maths.h:272
void V2D_F16_movePointEx(V2f16 *pt, fix16 ang, fix16 dist, fix16 cosAdj, fix16 sinAdj)
Compute the new position of the point defined by (x1, y1) by moving it by the given 'distance' in the...
Definition maths.c:844
fix16 FF32_toFix16(fastfix32 value)
Convert fastfix32 to fix16.
Definition maths.c:691
fastfix32 FF32_frac(fastfix32 value)
Return fractional part of the specified value (fastfix32).
Definition maths.c:706
s16 mods(s32 op1, s16 op2)
Direct divs instruction (signed 32/16=16:16) access using inline assembly.
Definition maths.c:137
s32 F32_toInt(fix32 value)
Convert fix32 to integer.
Definition maths.c:522
fix16 F16_getAngle(fix16 x1, fix16 y1, fix16 x2, fix16 y2)
Compute and return the angle in degree between the 2 points defined by (x1,y1) and (x2,...
Definition maths.c:454
fix16 F16_degreeToRadian(fix16 degree)
Convert degree to radian (fix16)
Definition maths.c:444
fix16 F16_round(fix16 value)
Round the specified value to nearest integer (fix16).
Definition maths.c:321
fix16 F16_log2(fix16 value)
Compute and return the result of the Log2 of specified value (fix16).
fastfix16 FF16_round(fastfix16 value)
Round the specified value to nearest integer (fastfix16).
Definition maths.c:655
fix16 F16_avg(fix16 val1, fix16 val2)
Compute and return the result of the average of val1 by val2 (fix16).
Definition maths.c:342
fix16 F16_normalizeAngle(fix16 angle)
Return a normalized form of the input angle degree: Output value is guaranteed to be in [FIX16(0)....
Definition maths.c:364
fix32 F32_div(fix32 val1, fix32 val2)
Compute and return the result of the division of val1 by val2 (fix32). WARNING: result can easily ov...
Definition maths.c:571
fix16 F16_atan2(fix16 y, fix16 x)
Compute the arctangent of y/x. i.e: return the angle (in degree) for the (0,0)-(x,...
Definition maths.c:416
fastfix32 FF32_int(fastfix32 value)
Return integer part of the specified value (fastfix32).
Definition maths.c:711
Vect2D_s32 V2s32
alias for Vect2D_s32
Definition maths.h:264
fix16 FF16_toFix16(fastfix16 value)
Convert fastfix16 to fix16.
Definition maths.c:630
fastfix32 FF32_round(fastfix32 value)
Round the specified value to nearest integer (fastfix32).
Definition maths.c:716
Mat2D_ff32 M2ff32
alias for Mat2D_ff32
Definition maths.h:296
fix32 cosFix32(u16 value)
Compute cosinus of specified value and return it as fix32. The input value is an integer defined as ...
Definition maths.c:609
fastfix16 F32_toFastFix16(fix32 value)
Convert specified fix32 value to fastfix16.
Definition maths.c:532
fastfix16 FF16_frac(fastfix16 value)
Return fractional part of the specified value (fastfix16).
Definition maths.c:645
fix32 F32_sin(fix16 angle)
Compute sinus of specified angle (in degree) and return it as fix32.
Definition maths.c:585
fix16 F16_atan(fix16 x)
Compute the arctangent of specified value and return it in degree (fix16).
Definition maths.c:397
u32 u16ToBCD(u16 value)
Convert u16 to BCD.
Definition maths.c:169
fix16 F16_tan(fix16 angle)
Compute the tangent of specified angle (in degree) and return it (fix16).
Definition maths.c:392
Vect2D_ff32 V2ff32
alias for Vect2D_ff32
Definition maths.h:280
fix16 cosFix16(u16 value)
Compute cosinus of specified value and return it as fix16. The input value is an integer defined as ...
Definition maths.c:506
fastfix16 F16_toFastFix16(fix16 value)
Convert specified fix16 value to fastfix16.
Definition maths.c:296
2x2 Matrice structure - f16 (fix16) type. Internally uses 2 2D vectors.
Definition maths.h:209
2x2 Matrice structure - f32 (fix32) type. Internally uses 2 2D vectors.
Definition maths.h:220
2x2 Matrice structure - ff16 (fastfix16) type. Internally uses 2 2D vectors.
Definition maths.h:231
2x2 Matrice structure - ff32 (fastfix32) type. Internally uses 2 2D vectors.
Definition maths.h:242
2D Vector structure - f16 (fix16) type.
Definition maths.h:168
2D Vector structure - f32 (fix32) type.
Definition maths.h:178
2D Vector structure - ff16 (fastfix16) type.
Definition maths.h:188
2D Vector structure - ff32 (fastfix32) type.
Definition maths.h:198
2D Vector structure - s16 type.
Definition maths.h:138
2D Vector structure - s32 type.
Definition maths.h:158
2D Vector structure - u16 type.
Definition maths.h:128
2D Vector structure - u32 type.
Definition maths.h:148
s16 fix16
Definition types.h:203
s32 fastfix32
Definition types.h:229
unsigned long u32
Definition types.h:105
short s16
Definition types.h:84
long s32
Definition types.h:89
s16 fastfix16
Definition types.h:224
unsigned short u16
Definition types.h:100
s32 fix32
Definition types.h:208