diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-04-07 12:29:46 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-04-07 12:29:46 +0000 |
commit | 3ade1510e72926d02d7c7d4416257449bc0cd3f3 (patch) | |
tree | c51d4960cac0fcd8bf3483a8e77444ac5f9a3177 /third_party/gsm/tls/sweet.c | |
parent | bfd3f58f5b715238fe618d053ddf908a34f1e56c (diff) |
Split speex, portaudio, and gsm into third_party directory
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/split-3rd-party@1168 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'third_party/gsm/tls/sweet.c')
-rw-r--r-- | third_party/gsm/tls/sweet.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/third_party/gsm/tls/sweet.c b/third_party/gsm/tls/sweet.c new file mode 100644 index 00000000..6a6fb297 --- /dev/null +++ b/third_party/gsm/tls/sweet.c @@ -0,0 +1,66 @@ + /* + * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische + * Universitaet Berlin. See the accompanying file "COPYRIGHT" for + * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + */ + +/*$Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/sweet.c,v 1.2 1996/07/02 10:15:53 jutta Exp $*/ + +/* Generate code to unpack a bit array from name:#bits description */ + +#include <stdio.h> +#include "taste.h" +#include "proto.h" + +void write_code P2((s_spex, n_spex), struct spex * s_spex, int n_spex) +{ + struct spex * sp = s_spex; + int bits = 8; + int vars; + + if (!n_spex) return; + + vars = sp->varsize; + + while (n_spex) { + + if (vars == sp->varsize) { + printf("\t%s = ", sp->var); + } else printf("\t%s |= ", sp->var); + + if (vars == bits) { + + if (bits == 8) printf( "*c++;\n" ); + else printf( "*c++ & 0x%lX;\n", + ~(0xfffffffe << (bits - 1)) ); + + if (!-- n_spex) break; + sp++; + vars = sp->varsize; + bits = 8; + + } else if (vars < bits) { + + printf( "(*c >> %d) & 0x%lX;\n", + bits - vars, + ~(0xfffffffe << (vars - 1))); + + bits -= vars; + if (!--n_spex) break; + sp++; + vars = sp->varsize; + + } else { + /* vars > bits. We're eating lower-all of c, + * but we must shift it. + */ + printf( "(*c++ & 0x%X) << %d;\n", + ~(0xfffffffe << (bits - 1)), + vars - bits ); + + vars -= bits; + bits = 8; + } + } +} + |