FreeCalypso > hg > gsmhr-codec-ref
comparison mathhalf.h @ 0:9008dbc8ca74
import original C code from GSM 06.06
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 14 Jun 2024 23:27:16 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:9008dbc8ca74 |
---|---|
1 #ifndef __MATHHALF | |
2 #define __MATHHALF | |
3 | |
4 #include "typedefs.h" | |
5 | |
6 /*_________________________________________________________________________ | |
7 | | | |
8 | Function Prototypes | | |
9 |_________________________________________________________________________| | |
10 */ | |
11 | |
12 /* addition */ | |
13 /************/ | |
14 | |
15 Shortword add(Shortword var1, Shortword var2); /* 1 ops */ | |
16 Shortword sub(Shortword var1, Shortword var2); /* 1 ops */ | |
17 Longword L_add(Longword L_var1, Longword L_var2); /* 2 ops */ | |
18 Longword L_sub(Longword L_var1, Longword L_var2); /* 2 ops */ | |
19 | |
20 /* multiplication */ | |
21 /******************/ | |
22 | |
23 Shortword mult(Shortword var1, Shortword var2); /* 1 ops */ | |
24 Longword L_mult(Shortword var1, Shortword var2); /* 1 ops */ | |
25 Shortword mult_r(Shortword var1, Shortword var2); /* 2 ops */ | |
26 | |
27 | |
28 /* arithmetic shifts */ | |
29 /*********************/ | |
30 | |
31 Shortword shr(Shortword var1, Shortword var2); /* 1 ops */ | |
32 Shortword shl(Shortword var1, Shortword var2); /* 1 ops */ | |
33 Longword L_shr(Longword L_var1, Shortword var2); /* 2 ops */ | |
34 Longword L_shl(Longword L_var1, Shortword var2); /* 2 ops */ | |
35 Shortword shift_r(Shortword var, Shortword var2); /* 2 ops */ | |
36 Longword L_shift_r(Longword L_var, Shortword var2); /* 3 ops */ | |
37 | |
38 /* absolute value */ | |
39 /*******************/ | |
40 | |
41 Shortword abs_s(Shortword var1); /* 1 ops */ | |
42 Longword L_abs(Longword var1); /* 3 ops */ | |
43 | |
44 | |
45 /* multiply accumulate */ | |
46 /************************/ | |
47 | |
48 Longword L_mac(Longword L_var3, | |
49 Shortword var1, Shortword var2); /* 1 op */ | |
50 Shortword mac_r(Longword L_var3, | |
51 Shortword var1, Shortword var2); /* 2 op */ | |
52 Longword L_msu(Longword L_var3, | |
53 Shortword var1, Shortword var2); /* 1 op */ | |
54 Shortword msu_r(Longword L_var3, | |
55 Shortword var1, Shortword var2); /* 2 op */ | |
56 | |
57 /* negation */ | |
58 /*************/ | |
59 | |
60 Shortword negate(Shortword var1); /* 1 ops */ | |
61 Longword L_negate(Longword L_var1); /* 2 ops */ | |
62 | |
63 | |
64 /* Accumulator manipulation */ | |
65 /****************************/ | |
66 | |
67 Longword L_deposit_l(Shortword var1); /* 1 ops */ | |
68 Longword L_deposit_h(Shortword var1); /* 1 ops */ | |
69 Shortword extract_l(Longword L_var1); /* 1 ops */ | |
70 Shortword extract_h(Longword L_var1); /* 1 ops */ | |
71 | |
72 /* Round */ | |
73 /*********/ | |
74 | |
75 Shortword round(Longword L_var1); /* 1 ops */ | |
76 | |
77 /* Normalization */ | |
78 /*****************/ | |
79 | |
80 Shortword norm_l(Longword L_var1); /* 30 ops */ | |
81 Shortword norm_s(Shortword var1); /* 15 ops */ | |
82 | |
83 /* Division */ | |
84 /************/ | |
85 Shortword divide_s(Shortword var1, Shortword var2); /* 18 ops */ | |
86 | |
87 /* Non-saturating instructions */ | |
88 /*******************************/ | |
89 Longword L_add_c(Longword L_Var1, Longword L_Var2); /* 2 ops */ | |
90 Longword L_sub_c(Longword L_Var1, Longword L_Var2); /* 2 ops */ | |
91 Longword L_sat(Longword L_var1); /* 4 ops */ | |
92 Longword L_macNs(Longword L_var3, | |
93 Shortword var1, Shortword var2); /* 1 ops */ | |
94 Longword L_msuNs(Longword L_var3, | |
95 Shortword var1, Shortword var2); /* 1 ops */ | |
96 | |
97 #endif |