comparison libgsmefr/basic_op.h @ 38:38326102fc43

libgsmefr: beginning to integrate code from ETSI
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 24 Nov 2022 05:30:03 +0000
parents
children 1c514150c033
comparison
equal deleted inserted replaced
37:b4db5366b595 38:38326102fc43
1 /*___________________________________________________________________________
2 | |
3 | Constants and Globals |
4 |___________________________________________________________________________|
5 */
6 extern __thread Flag Overflow;
7 extern __thread Flag Carry;
8
9 #define MAX_32 (Word32)0x7fffffffL
10 #define MIN_32 (Word32)0x80000000L
11
12 #define MAX_16 (Word16)0x7fff
13 #define MIN_16 (Word16)0x8000
14
15 /*___________________________________________________________________________
16 | |
17 | Prototypes for basic arithmetic operators |
18 |___________________________________________________________________________|
19 */
20
21 Word16 add (Word16 var1, Word16 var2); /* Short add, 1 */
22 Word16 sub (Word16 var1, Word16 var2); /* Short sub, 1 */
23 Word16 abs_s (Word16 var1); /* Short abs, 1 */
24 Word16 shl (Word16 var1, Word16 var2); /* Short shift left, 1 */
25 Word16 shr (Word16 var1, Word16 var2); /* Short shift right, 1 */
26 Word16 mult (Word16 var1, Word16 var2); /* Short mult, 1 */
27 Word32 L_mult (Word16 var1, Word16 var2); /* Long mult, 1 */
28 Word16 negate (Word16 var1); /* Short negate, 1 */
29 Word16 extract_h (Word32 L_var1); /* Extract high, 1 */
30 Word16 extract_l (Word32 L_var1); /* Extract low, 1 */
31 Word16 round (Word32 L_var1); /* Round, 1 */
32 Word32 L_mac (Word32 L_var3, Word16 var1, Word16 var2); /* Mac, 1 */
33 Word32 L_msu (Word32 L_var3, Word16 var1, Word16 var2); /* Msu, 1 */
34 Word32 L_macNs (Word32 L_var3, Word16 var1, Word16 var2); /* Mac without
35 sat, 1 */
36 Word32 L_msuNs (Word32 L_var3, Word16 var1, Word16 var2); /* Msu without
37 sat, 1 */
38 Word32 L_add (Word32 L_var1, Word32 L_var2); /* Long add, 2 */
39 Word32 L_sub (Word32 L_var1, Word32 L_var2); /* Long sub, 2 */
40 Word32 L_add_c (Word32 L_var1, Word32 L_var2); /* Long add with c, 2 */
41 Word32 L_sub_c (Word32 L_var1, Word32 L_var2); /* Long sub with c, 2 */
42 Word32 L_negate (Word32 L_var1); /* Long negate, 2 */
43 Word16 mult_r (Word16 var1, Word16 var2); /* Mult with round, 2 */
44 Word32 L_shl (Word32 L_var1, Word16 var2); /* Long shift left, 2 */
45 Word32 L_shr (Word32 L_var1, Word16 var2); /* Long shift right, 2*/
46 Word16 shr_r (Word16 var1, Word16 var2); /* Shift right with
47 round, 2 */
48 Word16 mac_r (Word32 L_var3, Word16 var1, Word16 var2); /* Mac with
49 rounding,2 */
50 Word16 msu_r (Word32 L_var3, Word16 var1, Word16 var2); /* Msu with
51 rounding,2 */
52 Word32 L_deposit_h (Word16 var1); /* 16 bit var1 -> MSB, 2 */
53 Word32 L_deposit_l (Word16 var1); /* 16 bit var1 -> LSB, 2 */
54
55 Word32 L_shr_r (Word32 L_var1, Word16 var2); /* Long shift right with
56 round, 3 */
57 Word32 L_abs (Word32 L_var1); /* Long abs, 3 */
58 Word32 L_sat (Word32 L_var1); /* Long saturation, 4 */
59 Word16 norm_s (Word16 var1); /* Short norm, 15 */
60 Word16 div_s (Word16 var1, Word16 var2); /* Short division, 18 */
61 Word16 norm_l (Word32 L_var1); /* Long norm, 30 */
62