| 62 | #define BCOPY(p1, p2, n) bcopy((void *)(p1), (void *)(p2), (int)(n)) |
| 63 | |
| 64 | void |
| 65 | sl_compress_init(struct slcompress *comp, int max_state) |
| 66 | { |
| 67 | u_int i; |
| 68 | struct cstate *tstate = comp->tstate; |
| 69 | |
| 70 | if (max_state == -1) { |
| 71 | max_state = MAX_STATES - 1; |
| 72 | bzero((char *)comp, sizeof(*comp)); |
| 73 | } else { |
| 74 | /* Don't reset statistics */ |
| 75 | bzero((char *)comp->tstate, sizeof(comp->tstate)); |
| 76 | bzero((char *)comp->rstate, sizeof(comp->rstate)); |
| 77 | } |
| 78 | for (i = max_state; i > 0; --i) { |
| 79 | tstate[i].cs_id = i; |
| 80 | tstate[i].cs_next = &tstate[i - 1]; |
| 81 | } |
| 82 | tstate[0].cs_next = &tstate[max_state]; |
| 83 | tstate[0].cs_id = 0; |
| 84 | comp->last_cs = &tstate[0]; |
| 85 | comp->last_recv = 255; |
| 86 | comp->last_xmit = 255; |
| 87 | comp->flags = SLF_TOSS; |
| 88 | } |
| 89 | |
| 90 | /* ENCODE encodes a number that is known to be non-zero. ENCODEZ |
| 91 | * checks for zero (since zero has to be encoded in the long, 3 byte |
no test coverage detected