comparison libgsmefr/oper_32b.c @ 348:3da7ab45910d

libgsmefr: inline L_Comp() and L_Extract()
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 22 Apr 2024 00:05:01 +0000
parents 92479d9a8e38
children
comparison
equal deleted inserted replaced
347:1c514150c033 348:3da7ab45910d
25 #include "typedef.h" 25 #include "typedef.h"
26 #include "namespace.h" 26 #include "namespace.h"
27 #include "basic_op.h" 27 #include "basic_op.h"
28 #include "oper_32b.h" 28 #include "oper_32b.h"
29 #include "no_count.h" 29 #include "no_count.h"
30
31 /*****************************************************************************
32 * *
33 * Function L_Extract() *
34 * *
35 * Extract from a 32 bit integer two 16 bit DPF. *
36 * *
37 * Arguments: *
38 * *
39 * L_32 : 32 bit integer. *
40 * 0x8000 0000 <= L_32 <= 0x7fff ffff. *
41 * hi : b16 to b31 of L_32 *
42 * lo : (L_32 - hi<<16)>>1 *
43 *****************************************************************************
44 */
45
46 void L_Extract (Word32 L_32, Word16 *hi, Word16 *lo)
47 {
48 *hi = extract_h (L_32);
49 *lo = extract_l (L_msu (L_shr (L_32, 1), *hi, 16384));
50 return;
51 }
52
53 /*****************************************************************************
54 * *
55 * Function L_Comp() *
56 * *
57 * Compose from two 16 bit DPF a 32 bit integer. *
58 * *
59 * L_32 = hi<<16 + lo<<1 *
60 * *
61 * Arguments: *
62 * *
63 * hi msb *
64 * lo lsf (with sign) *
65 * *
66 * Return Value : *
67 * *
68 * 32 bit long signed integer (Word32) whose value falls in the *
69 * range : 0x8000 0000 <= L_32 <= 0x7fff fff0. *
70 * *
71 *****************************************************************************
72 */
73
74 Word32 L_Comp (Word16 hi, Word16 lo)
75 {
76 Word32 L_32;
77
78 L_32 = L_deposit_h (hi);
79 return (L_mac (L_32, lo, 1)); /* = hi<<16 + lo<<1 */
80 }
81 30
82 /***************************************************************************** 31 /*****************************************************************************
83 * Function Mpy_32() * 32 * Function Mpy_32() *
84 * * 33 * *
85 * Multiply two 32 bit integers (DPF). The result is divided by 2**31 * 34 * Multiply two 32 bit integers (DPF). The result is divided by 2**31 *