annotate mathhalf.h @ 1:dc0dd42ee8f2

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