2
|
1 /*
|
|
2 * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
|
3 * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
|
4 * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
|
5 */
|
|
6
|
|
7 /* $Header: /home/kbs/jutta/src/gsm/gsm-1.0/src/RCS/gsm_implode.c,v 1.1 1992/10/28 00:15:50 jutta Exp $ */
|
|
8
|
|
9 #include "private.h"
|
|
10
|
|
11 #include "gsm.h"
|
|
12 #include "proto.h"
|
|
13
|
|
14 void gsm_implode P3((s, source, c), gsm s, gsm_signal * source,
|
|
15 gsm_byte * c)
|
|
16 {
|
|
17 /* variable size index
|
|
18
|
|
19 GSM_MAGIC 4 -
|
|
20
|
|
21 LARc[0] 6 0
|
|
22 LARc[1] 6 1
|
|
23 LARc[2] 5 2
|
|
24 LARc[3] 5 3
|
|
25 LARc[4] 4 4
|
|
26 LARc[5] 4 5
|
|
27 LARc[6] 3 6
|
|
28 LARc[7] 3 7
|
|
29
|
|
30 Nc[0] 7 8
|
|
31 bc[0] 2 9
|
|
32 Mc[0] 2 10
|
|
33 xmaxc[0] 6 11
|
|
34 xmc[0] 3 12
|
|
35 xmc[1] 3 13
|
|
36 xmc[2] 3 14
|
|
37 xmc[3] 3 15
|
|
38 xmc[4] 3 16
|
|
39 xmc[5] 3 17
|
|
40 xmc[6] 3 18
|
|
41 xmc[7] 3 19
|
|
42 xmc[8] 3 20
|
|
43 xmc[9] 3 21
|
|
44 xmc[10] 3 22
|
|
45 xmc[11] 3 23
|
|
46 xmc[12] 3 24
|
|
47
|
|
48 Nc[1] 7 25
|
|
49 bc[1] 2 26
|
|
50 Mc[1] 2 27
|
|
51 xmaxc[1] 6 28
|
|
52 xmc[13] 3 29
|
|
53 xmc[14] 3 30
|
|
54 xmc[15] 3 31
|
|
55 xmc[16] 3 32
|
|
56 xmc[17] 3 33
|
|
57 xmc[18] 3 34
|
|
58 xmc[19] 3 35
|
|
59 xmc[20] 3 36
|
|
60 xmc[21] 3 37
|
|
61 xmc[22] 3 38
|
|
62 xmc[23] 3 39
|
|
63 xmc[24] 3 40
|
|
64 xmc[25] 3 41
|
|
65
|
|
66 Nc[2] 7 42
|
|
67 bc[2] 2 43
|
|
68 Mc[2] 2 44
|
|
69 xmaxc[2] 6 45
|
|
70 xmc[26] 3 46
|
|
71 xmc[27] 3 47
|
|
72 xmc[28] 3 48
|
|
73 xmc[29] 3 49
|
|
74 xmc[30] 3 50
|
|
75 xmc[31] 3 51
|
|
76 xmc[32] 3 52
|
|
77 xmc[33] 3 53
|
|
78 xmc[34] 3 54
|
|
79 xmc[35] 3 55
|
|
80 xmc[36] 3 56
|
|
81 xmc[37] 3 57
|
|
82 xmc[38] 3 58
|
|
83
|
|
84 Nc[3] 7 59
|
|
85 bc[3] 2 60
|
|
86 Mc[3] 2 61
|
|
87 xmaxc[3] 6 62
|
|
88 xmc[39] 3 63
|
|
89 xmc[40] 3 64
|
|
90 xmc[41] 3 65
|
|
91 xmc[42] 3 66
|
|
92 xmc[43] 3 67
|
|
93 xmc[44] 3 68
|
|
94 xmc[45] 3 69
|
|
95 xmc[46] 3 70
|
|
96 xmc[47] 3 71
|
|
97 xmc[48] 3 72
|
|
98 xmc[49] 3 73
|
|
99 xmc[50] 3 74
|
|
100 xmc[51] 3 75
|
|
101 */
|
|
102
|
|
103
|
|
104 #define LARc source
|
|
105
|
|
106 *c++ = ((GSM_MAGIC & 0xF) << 4) /* 1 */
|
|
107 |((LARc[0] >> 2) & 0xF);
|
|
108 *c++ = ((LARc[0] & 0x3) << 6)
|
|
109 | (LARc[1] & 0x3F);
|
|
110 *c++ = ((LARc[2] & 0x1F) << 3)
|
|
111 | ((LARc[3] >> 2) & 0x7);
|
|
112 *c++ = ((LARc[3] & 0x3) << 6)
|
|
113 | ((LARc[4] & 0xF) << 2)
|
|
114 | ((LARc[5] >> 2) & 0x3);
|
|
115 *c++ = ((LARc[5] & 0x3) << 6)
|
|
116 | ((LARc[6] & 0x7) << 3)
|
|
117 | (LARc[7] & 0x7);
|
|
118
|
|
119 #define Nc (source + 8)
|
|
120
|
|
121 *c++ = ((Nc[0] & 0x7F) << 1)
|
|
122 #define bc (source + 9)
|
|
123 | ((bc[0] >> 1) & 0x1);
|
|
124 *c++ = ((bc[0] & 0x1) << 7)
|
|
125 #define Mc (source + 10)
|
|
126 | ((Mc[0] & 0x3) << 5)
|
|
127 #define xmaxc (source + 11)
|
|
128 | ((xmaxc[0] >> 1) & 0x1F);
|
|
129 *c++ = ((xmaxc[0] & 0x1) << 7)
|
|
130 #define xmc (source + 12)
|
|
131 | ((xmc[0] & 0x7) << 4)
|
|
132 | ((xmc[1] & 0x7) << 1)
|
|
133 | ((xmc[2] >> 2) & 0x1);
|
|
134 *c++ = ((xmc[2] & 0x3) << 6)
|
|
135 | ((xmc[3] & 0x7) << 3)
|
|
136 | (xmc[4] & 0x7);
|
|
137 *c++ = ((xmc[5] & 0x7) << 5) /* 10 */
|
|
138 |((xmc[6] & 0x7) << 2)
|
|
139 | ((xmc[7] >> 1) & 0x3);
|
|
140 *c++ = ((xmc[7] & 0x1) << 7)
|
|
141 | ((xmc[8] & 0x7) << 4)
|
|
142 | ((xmc[9] & 0x7) << 1)
|
|
143 | ((xmc[10] >> 2) & 0x1);
|
|
144 *c++ = ((xmc[10] & 0x3) << 6)
|
|
145 | ((xmc[11] & 0x7) << 3)
|
|
146 | (xmc[12] & 0x7);
|
|
147
|
|
148 #undef Nc
|
|
149 #define Nc (source + 25 - 1)
|
|
150
|
|
151 *c++ = ((Nc[1] & 0x7F) << 1)
|
|
152 #undef bc
|
|
153 #define bc (source + 26 - 1)
|
|
154 | ((bc[1] >> 1) & 0x1);
|
|
155 *c++ = ((bc[1] & 0x1) << 7)
|
|
156 #undef Mc
|
|
157 #define Mc (source + 27 - 1)
|
|
158 | ((Mc[1] & 0x3) << 5)
|
|
159 #undef xmaxc
|
|
160 #define xmaxc (source + 28 - 1)
|
|
161 | ((xmaxc[1] >> 1) & 0x1F);
|
|
162 *c++ = ((xmaxc[1] & 0x1) << 7)
|
|
163 #undef xmc
|
|
164 #define xmc (source + 29 - 13)
|
|
165 | ((xmc[13] & 0x7) << 4)
|
|
166 | ((xmc[14] & 0x7) << 1)
|
|
167 | ((xmc[15] >> 2) & 0x1);
|
|
168 *c++ = ((xmc[15] & 0x3) << 6)
|
|
169 | ((xmc[16] & 0x7) << 3)
|
|
170 | (xmc[17] & 0x7);
|
|
171 *c++ = ((xmc[18] & 0x7) << 5)
|
|
172 | ((xmc[19] & 0x7) << 2)
|
|
173 | ((xmc[20] >> 1) & 0x3);
|
|
174 *c++ = ((xmc[20] & 0x1) << 7)
|
|
175 | ((xmc[21] & 0x7) << 4)
|
|
176 | ((xmc[22] & 0x7) << 1)
|
|
177 | ((xmc[23] >> 2) & 0x1);
|
|
178 *c++ = ((xmc[23] & 0x3) << 6)
|
|
179 | ((xmc[24] & 0x7) << 3)
|
|
180 | (xmc[25] & 0x7);
|
|
181
|
|
182 #undef Nc
|
|
183 #define Nc (source + 42 - 2)
|
|
184
|
|
185 *c++ = ((Nc[2] & 0x7F) << 1)
|
|
186 /* 20 */
|
|
187 #undef bc
|
|
188 #define bc (source + 43 - 2)
|
|
189 | ((bc[2] >> 1) & 0x1);
|
|
190 *c++ = ((bc[2] & 0x1) << 7)
|
|
191 #undef Mc
|
|
192 #define Mc (source + 44 - 2)
|
|
193 | ((Mc[2] & 0x3) << 5)
|
|
194 #undef xmaxc
|
|
195 #define xmaxc (source + 45 - 2)
|
|
196 | ((xmaxc[2] >> 1) & 0x1F);
|
|
197 *c++ = ((xmaxc[2] & 0x1) << 7)
|
|
198 #undef xmc
|
|
199 #define xmc (source + 46 - 26)
|
|
200 | ((xmc[26] & 0x7) << 4)
|
|
201 | ((xmc[27] & 0x7) << 1)
|
|
202 | ((xmc[28] >> 2) & 0x1);
|
|
203 *c++ = ((xmc[28] & 0x3) << 6)
|
|
204 | ((xmc[29] & 0x7) << 3)
|
|
205 | (xmc[30] & 0x7);
|
|
206 *c++ = ((xmc[31] & 0x7) << 5)
|
|
207 | ((xmc[32] & 0x7) << 2)
|
|
208 | ((xmc[33] >> 1) & 0x3);
|
|
209 *c++ = ((xmc[33] & 0x1) << 7)
|
|
210 | ((xmc[34] & 0x7) << 4)
|
|
211 | ((xmc[35] & 0x7) << 1)
|
|
212 | ((xmc[36] >> 2) & 0x1);
|
|
213 *c++ = ((xmc[36] & 0x3) << 6)
|
|
214 | ((xmc[37] & 0x7) << 3)
|
|
215 | (xmc[38] & 0x7);
|
|
216
|
|
217 #undef Nc
|
|
218 #define Nc (source + 59 - 3)
|
|
219
|
|
220 *c++ = ((Nc[3] & 0x7F) << 1)
|
|
221 #undef bc
|
|
222 #define bc (source + 60 - 3)
|
|
223 | ((bc[3] >> 1) & 0x1);
|
|
224 *c++ = ((bc[3] & 0x1) << 7)
|
|
225 #undef Mc
|
|
226 #define Mc (source + 61 - 3)
|
|
227 | ((Mc[3] & 0x3) << 5)
|
|
228 #undef xmaxc
|
|
229 #define xmaxc (source + 62 - 3)
|
|
230 | ((xmaxc[3] >> 1) & 0x1F);
|
|
231 *c++ = ((xmaxc[3] & 0x1) << 7)
|
|
232 #undef xmc
|
|
233 #define xmc (source + 63 - 39)
|
|
234 | ((xmc[39] & 0x7) << 4)
|
|
235 | ((xmc[40] & 0x7) << 1)
|
|
236 | ((xmc[41] >> 2) & 0x1);
|
|
237 *c++ = ((xmc[41] & 0x3) << 6) /* 30 */
|
|
238 |((xmc[42] & 0x7) << 3)
|
|
239 | (xmc[43] & 0x7);
|
|
240 *c++ = ((xmc[44] & 0x7) << 5)
|
|
241 | ((xmc[45] & 0x7) << 2)
|
|
242 | ((xmc[46] >> 1) & 0x3);
|
|
243 *c++ = ((xmc[46] & 0x1) << 7)
|
|
244 | ((xmc[47] & 0x7) << 4)
|
|
245 | ((xmc[48] & 0x7) << 1)
|
|
246 | ((xmc[49] >> 2) & 0x1);
|
|
247 *c++ = ((xmc[49] & 0x3) << 6)
|
|
248 | ((xmc[50] & 0x7) << 3)
|
|
249 | (xmc[51] & 0x7);
|
|
250 }
|