MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sl_compress_init

Function sl_compress_init

freebsd/net/slcompress.c:64–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62#define BCOPY(p1, p2, n) bcopy((void *)(p1), (void *)(p2), (int)(n))
63
64void
65sl_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

Callers 4

sppp_attachFunction · 0.85
sppp_ipcp_RCRFunction · 0.85
sppp_ipcp_RCN_nakFunction · 0.85
ng_vjc_rcvmsgFunction · 0.85

Calls 1

bzeroFunction · 0.85

Tested by

no test coverage detected