comparison libcommon/gsm7_unpack.c @ 50:dc8a2e6fa03e

fc-simtool pnn-dump implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 13 Feb 2021 04:31:02 +0000
parents
children
comparison
equal deleted inserted replaced
49:bbc2821288aa 50:dc8a2e6fa03e
1 /*
2 * This library module implements unpacking of GSM 7-bit data
3 * from packed octets.
4 */
5
6 #include <sys/types.h>
7
8 static u_char shift[8] = {0, 7, 6, 5, 4, 3, 2, 1};
9
10 gsm7_unpack(inbuf, outbuf, nseptets)
11 u_char *inbuf, *outbuf;
12 unsigned nseptets;
13 {
14 u_char *inp = inbuf, *outp = outbuf;
15 unsigned n;
16
17 for (n = 0; n < nseptets; n++) {
18 *outp++ = (((inp[1] << 8) | inp[0]) >> shift[n&7]) & 0x7F;
19 if (n & 7)
20 inp++;
21 }
22 }