annotate libgsmhr1/mathhalf.h @ 540:5595293e4f29

gsmx-to-tw5a utility: use emit_hex_frame() in libtest
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 22 Sep 2024 00:36:35 +0000
parents 597b39aef484
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
500
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #ifndef __MATHHALF
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 #define __MATHHALF
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 #include "typedefs.h"
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 /*_________________________________________________________________________
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 | |
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 | Function Prototypes |
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 |_________________________________________________________________________|
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 /* addition */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 /************/
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 Shortword add(Shortword var1, Shortword var2); /* 1 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 Shortword sub(Shortword var1, Shortword var2); /* 1 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 Longword L_add(Longword L_var1, Longword L_var2); /* 2 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 Longword L_sub(Longword L_var1, Longword L_var2); /* 2 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 /* multiplication */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 /******************/
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 Shortword mult(Shortword var1, Shortword var2); /* 1 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 Longword L_mult(Shortword var1, Shortword var2); /* 1 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 Shortword mult_r(Shortword var1, Shortword var2); /* 2 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 /* arithmetic shifts */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 /*********************/
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 Shortword shr(Shortword var1, Shortword var2); /* 1 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 Shortword shl(Shortword var1, Shortword var2); /* 1 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 Longword L_shr(Longword L_var1, Shortword var2); /* 2 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 Longword L_shl(Longword L_var1, Shortword var2); /* 2 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 Shortword shift_r(Shortword var, Shortword var2); /* 2 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 Longword L_shift_r(Longword L_var, Shortword var2); /* 3 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 /* absolute value */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 /*******************/
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 Shortword abs_s(Shortword var1); /* 1 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 Longword L_abs(Longword var1); /* 3 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 /* multiply accumulate */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 /************************/
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 Longword L_mac(Longword L_var3,
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 Shortword var1, Shortword var2); /* 1 op */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 Shortword mac_r(Longword L_var3,
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 Shortword var1, Shortword var2); /* 2 op */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 Longword L_msu(Longword L_var3,
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 Shortword var1, Shortword var2); /* 1 op */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 Shortword msu_r(Longword L_var3,
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 Shortword var1, Shortword var2); /* 2 op */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 /* negation */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 /*************/
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 Shortword negate(Shortword var1); /* 1 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 Longword L_negate(Longword L_var1); /* 2 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 /* Accumulator manipulation */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 /****************************/
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 Longword L_deposit_l(Shortword var1); /* 1 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 Longword L_deposit_h(Shortword var1); /* 1 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 Shortword extract_l(Longword L_var1); /* 1 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 Shortword extract_h(Longword L_var1); /* 1 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 /* Round */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 /*********/
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 Shortword round(Longword L_var1); /* 1 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 /* Normalization */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 /*****************/
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 Shortword norm_l(Longword L_var1); /* 30 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 Shortword norm_s(Shortword var1); /* 15 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 /* Division */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 /************/
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 Shortword divide_s(Shortword var1, Shortword var2); /* 18 ops */
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86
66fb1fd032e6 libgsmhr1/mathhalf.[ch]: import original
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 #endif