comparison uptools/libcoding/gsm7_pack.c @ 357:15120d15cab5

uptools/libcoding: septet to octet packing function implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 07 Feb 2018 06:50:14 +0000
parents
children
comparison
equal deleted inserted replaced
356:dbeb4a5628f5 357:15120d15cab5
1 /*
2 * This library module implements the function for packing septets into octets.
3 */
4
5 #include <sys/types.h>
6
7 gsm7_pack(inbuf, outbuf, noctets)
8 u_char *inbuf, *outbuf;
9 unsigned noctets;
10 {
11 u_char *ip = inbuf, *op = outbuf;
12 unsigned n, c;
13
14 for (n = 0; n < noctets; n++) {
15 c = n % 7;
16 *op++ = ((ip[1] << 7) | ip[0]) >> c;
17 if (c == 6)
18 ip += 2;
19 else
20 ip += 1;
21 }
22 }