Debian Codegraph @

gsm/gsm_explode.c

raw symbols SCIP
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: /usr/local/cvsroot/rplay/gsm/gsm_explode.c,v 1.1.1.1 1998/07/14 22:35:24 mrb Exp $ */
8
9 #include "private.h"
10 #include "gsm.h"
11 #include "proto.h"
12
13 int gsm_explode P3((s, c, target), gsm s, gsm_byte * c, gsm_signal * target)
14 {
15 /* GSM_MAGIC = (*c >> 4) & 0xF; */
16
17 if (((*c >> 4) & 0x0F) != GSM_MAGIC) return -1;
18
19 #define LARc target
20
21 LARc[0] = (*c++ & 0xF) << 2; /* 1 */
22 LARc[0] |= (*c >> 6) & 0x3;
23 LARc[1] = *c++ & 0x3F;
24 LARc[2] = (*c >> 3) & 0x1F;
25 LARc[3] = (*c++ & 0x7) << 2;
26 LARc[3] |= (*c >> 6) & 0x3;
27 LARc[4] = (*c >> 2) & 0xF;
28 LARc[5] = (*c++ & 0x3) << 2;
29 LARc[5] |= (*c >> 6) & 0x3;
30 LARc[6] = (*c >> 3) & 0x7;
31 LARc[7] = *c++ & 0x7;
32
33 #define Nc (target + 8)
34
35 Nc[0] = (*c >> 1) & 0x7F;
36
37 #define bc (target + 9)
38
39 bc[0] = (*c++ & 0x1) << 1;
40 bc[0] |= (*c >> 7) & 0x1;
41
42 #define Mc (target + 10)
43
44 Mc[0] = (*c >> 5) & 0x3;
45
46 #define xmaxc (target + 11)
47
48 xmaxc[0] = (*c++ & 0x1F) << 1;
49 xmaxc[0] |= (*c >> 7) & 0x1;
50
51 #define xmc (target + 12)
52
53 xmc[0] = (*c >> 4) & 0x7;
54 xmc[1] = (*c >> 1) & 0x7;
55 xmc[2] = (*c++ & 0x1) << 2;
56 xmc[2] |= (*c >> 6) & 0x3;
57 xmc[3] = (*c >> 3) & 0x7;
58 xmc[4] = *c++ & 0x7;
59 xmc[5] = (*c >> 5) & 0x7;
60 xmc[6] = (*c >> 2) & 0x7;
61 xmc[7] = (*c++ & 0x3) << 1; /* 10 */
62 xmc[7] |= (*c >> 7) & 0x1;
63 xmc[8] = (*c >> 4) & 0x7;
64 xmc[9] = (*c >> 1) & 0x7;
65 xmc[10] = (*c++ & 0x1) << 2;
66 xmc[10] |= (*c >> 6) & 0x3;
67 xmc[11] = (*c >> 3) & 0x7;
68 xmc[12] = *c++ & 0x7;
69
70 #undef Nc
71 #define Nc (target + 25 - 1)
72
73 Nc[1] = (*c >> 1) & 0x7F;
74
75 #undef bc
76 #define bc (target + 26 - 1)
77
78 bc[1] = (*c++ & 0x1) << 1;
79 bc[1] |= (*c >> 7) & 0x1;
80
81 #undef Mc
82 #define Mc (target + 27 - 1)
83
84 Mc[1] = (*c >> 5) & 0x3;
85
86 #undef xmaxc
87 #define xmaxc (target + 28 - 1)
88
89 xmaxc[1] = (*c++ & 0x1F) << 1;
90 xmaxc[1] |= (*c >> 7) & 0x1;
91
92 #undef xmc
93 #define xmc (target + 29 - 13)
94
95 xmc[13] = (*c >> 4) & 0x7;
96 xmc[14] = (*c >> 1) & 0x7;
97 xmc[15] = (*c++ & 0x1) << 2;
98 xmc[15] |= (*c >> 6) & 0x3;
99 xmc[16] = (*c >> 3) & 0x7;
100 xmc[17] = *c++ & 0x7;
101 xmc[18] = (*c >> 5) & 0x7;
102 xmc[19] = (*c >> 2) & 0x7;
103 xmc[20] = (*c++ & 0x3) << 1;
104 xmc[20] |= (*c >> 7) & 0x1;
105 xmc[21] = (*c >> 4) & 0x7;
106 xmc[22] = (*c >> 1) & 0x7;
107 xmc[23] = (*c++ & 0x1) << 2;
108 xmc[23] |= (*c >> 6) & 0x3;
109 xmc[24] = (*c >> 3) & 0x7;
110 xmc[25] = *c++ & 0x7;
111
112 #undef Nc
113 #define Nc (target + 42 - 2)
114
115 Nc[2] = (*c >> 1) & 0x7F;
116
117 #undef bc
118 #define bc (target + 43 - 2)
119
120 bc[2] = (*c++ & 0x1) << 1; /* 20 */
121 bc[2] |= (*c >> 7) & 0x1;
122
123 #undef Mc
124 #define Mc (target + 44 - 2)
125
126 Mc[2] = (*c >> 5) & 0x3;
127
128 #undef xmaxc
129 #define xmaxc (target + 45 - 2)
130
131 xmaxc[2] = (*c++ & 0x1F) << 1;
132 xmaxc[2] |= (*c >> 7) & 0x1;
133
134 #undef xmc
135 #define xmc (target + 46 - 26)
136
137 xmc[26] = (*c >> 4) & 0x7;
138 xmc[27] = (*c >> 1) & 0x7;
139 xmc[28] = (*c++ & 0x1) << 2;
140 xmc[28] |= (*c >> 6) & 0x3;
141 xmc[29] = (*c >> 3) & 0x7;
142 xmc[30] = *c++ & 0x7;
143 xmc[31] = (*c >> 5) & 0x7;
144 xmc[32] = (*c >> 2) & 0x7;
145 xmc[33] = (*c++ & 0x3) << 1;
146 xmc[33] |= (*c >> 7) & 0x1;
147 xmc[34] = (*c >> 4) & 0x7;
148 xmc[35] = (*c >> 1) & 0x7;
149 xmc[36] = (*c++ & 0x1) << 2;
150 xmc[36] |= (*c >> 6) & 0x3;
151 xmc[37] = (*c >> 3) & 0x7;
152 xmc[38] = *c++ & 0x7;
153
154 #undef Nc
155 #define Nc (target + 59 - 3)
156
157 Nc[3] = (*c >> 1) & 0x7F;
158
159 #undef bc
160 #define bc (target + 60 - 3)
161
162 bc[3] = (*c++ & 0x1) << 1;
163 bc[3] |= (*c >> 7) & 0x1;
164
165 #undef Mc
166 #define Mc (target + 61 - 3)
167
168 Mc[3] = (*c >> 5) & 0x3;
169
170 #undef xmaxc
171 #define xmaxc (target + 62 - 3)
172
173 xmaxc[3] = (*c++ & 0x1F) << 1;
174 xmaxc[3] |= (*c >> 7) & 0x1;
175
176 #undef xmc
177 #define xmc (target + 63 - 39)
178
179 xmc[39] = (*c >> 4) & 0x7;
180 xmc[40] = (*c >> 1) & 0x7;
181 xmc[41] = (*c++ & 0x1) << 2;
182 xmc[41] |= (*c >> 6) & 0x3;
183 xmc[42] = (*c >> 3) & 0x7;
184 xmc[43] = *c++ & 0x7; /* 30 */
185 xmc[44] = (*c >> 5) & 0x7;
186 xmc[45] = (*c >> 2) & 0x7;
187 xmc[46] = (*c++ & 0x3) << 1;
188 xmc[46] |= (*c >> 7) & 0x1;
189 xmc[47] = (*c >> 4) & 0x7;
190 xmc[48] = (*c >> 1) & 0x7;
191 xmc[49] = (*c++ & 0x1) << 2;
192 xmc[49] |= (*c >> 6) & 0x3;
193 xmc[50] = (*c >> 3) & 0x7;
194 xmc[51] = *c & 0x7; /* 33 */
195
196 return 0;
197 }