Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / devs / diskimage / dms / u_quick.c
blobdb0117d078dac62877e75c365bc0f3a2e3a86cdd
1 /*
2 * xDMS v1.3 - Portable DMS archive unpacker - Public Domain
3 * Written by Andre Rodrigues de la Rocha <adlroc@usa.net>
6 */
8 #include "xdms.h"
10 #define QBITMASK 0xff
12 UWORD Unpack_QUICK(struct xdms_data *xdms, UBYTE *in, UBYTE *out, UWORD origsize) {
13 UWORD quick_text_loc = xdms->quick_text_loc;
14 UBYTE *text = xdms->text;
15 UWORD i, j;
16 UBYTE *outend;
18 INITBITBUF(in);
20 outend = out+origsize;
21 while (out < outend) {
22 if (GETBITS(1)!=0) {
23 DROPBITS(1);
24 *out++ = text[quick_text_loc++ & QBITMASK] = (UBYTE)GETBITS(8); DROPBITS(8);
25 } else {
26 DROPBITS(1);
27 j = (UWORD)(GETBITS(2)+2); DROPBITS(2);
28 i = (UWORD)(quick_text_loc - GETBITS(8) - 1); DROPBITS(8);
29 while(j--) {
30 *out++ = text[quick_text_loc++ & QBITMASK] = text[i++ & QBITMASK];
34 xdms->quick_text_loc = (UWORD)((quick_text_loc+5) & QBITMASK);
36 return 0;