Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Decode(void) /* Just the reverse of Encode(). */
- {
- int i, j, k, r, c;
- unsigned int flags;
- for (i = 0; i < N - F; i++) text_buf[i] = ' ';
- r = N - F; flags = 0;
- for ( ; ; ) {
- if (((flags >>= 1) & 256) == 0) {
- if ((c = getc(infile)) == EOF) break;
- flags = c | 0xff00; /* uses higher byte cleverly */
- } /* to count eight */
- if (flags & 1) {
- if ((c = getc(infile)) == EOF) break;
- putc(c, outfile); text_buf[r++] = c; r &= (N - 1);
- } else {
- if ((i = getc(infile)) == EOF) break;
- if ((j = getc(infile)) == EOF) break;
- i |= ((j & 0xf0) << 4); j = (j & 0x0f) + THRESHOLD;
- for (k = 0; k <= j; k++) {
- c = text_buf[(i + k) & (N - 1)];
- putc(c, outfile); text_buf[r++] = c; r &= (N - 1);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement