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.
9
bitter, sweet \(em code-generators for packing bits
11
bitter < input > output
13
sweet < input > output
15
Bitter and sweet are two filters which turn a description of the
24
Bitter generates code that packs the specified bits from their
25
variables into an array of unsigned char referenced by an
28
Sweet generates code that unpacks the specified bits from an array
29
of unsigned char referenced by a mutable pointer c into the
32
.\" .SH "RETURN VALUE"
45
*c++ = ((amaretto & 0x1) << 7)
46
| ((banana & 0x3) << 5)
47
| ((cherry & 0x7) << 2)
48
| ((strawberry >> 2) & 0x3);
49
*c++ = ((strawberry & 0x3) << 6)
50
| ((vanilla >> 9) & 0x3F);
51
*c++ = ((vanilla >> 1) & 0xFF);
52
*c++ = ((vanilla & 0x1) << 7)
53
| ((walnut >> 8) & 0x7F);
57
amaretto = (*c >> 7) & 0x1;
58
banana = (*c >> 5) & 0x3;
59
cherry = (*c >> 2) & 0x7;
60
strawberry = (*c++ & 0x3) << 2;
61
strawberry |= (*c >> 6) & 0x3;
62
vanilla = (*c++ & 0x3F) << 9;
63
vanilla |= (*c++ & 0xFF) << 1;
64
vanilla |= (*c >> 7) & 0x1;
65
walnut = (*c++ & 0x7F) << 8;
68
This is a quick hack for the gsm_encode() and gsm_decode() routines.
70
Please direct bug reports to jutta@cs.tu-berlin.de and cabo@cs.tu-berlin.de.