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.
7 /*$Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/sweet.c,v 1.2 1996/07/02 10:15:53 jutta Exp $*/
9 /* Generate code to unpack a bit array from name:#bits description */
15 void write_code P2((s_spex, n_spex), struct spex * s_spex, int n_spex)
17 struct spex * sp = s_spex;
27 if (vars == sp->varsize) {
28 printf("\t%s = ", sp->var);
29 } else printf("\t%s |= ", sp->var);
33 if (bits == 8) printf( "*c++;\n" );
34 else printf( "*c++ & 0x%lX;\n",
35 ~(0xfffffffe << (bits - 1)) );
37 if (!-- n_spex) break;
42 } else if (vars < bits) {
44 printf( "(*c >> %d) & 0x%lX;\n",
46 ~(0xfffffffe << (vars - 1)));
54 /* vars > bits. We're eating lower-all of c,
55 * but we must shift it.
57 printf( "(*c++ & 0x%X) << %d;\n",
58 ~(0xfffffffe << (bits - 1)),