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

Function putbits8

freebsd/net/mppcc.c:57–77  ·  view source on GitHub ↗

Inserts 1 to 8 bits into the output buffer. */

Source from the content-addressed store, hash-verified

55
56/* Inserts 1 to 8 bits into the output buffer. */
57static void __inline
58putbits8(uint8_t *buf, uint32_t val, const uint32_t n, uint32_t *i, uint32_t *l)
59{
60 buf += *i;
61 if (*l >= n) {
62 *l = (*l) - n;
63 val <<= *l;
64 *buf = *buf | (val & 0xff);
65 if (*l == 0) {
66 *l = 8;
67 (*i)++;
68 *(++buf) = 0;
69 }
70 } else {
71 (*i)++;
72 *l = 8 - n + (*l);
73 val <<= *l;
74 *buf = *buf | ((val >> 8) & 0xff);
75 *(++buf) = val & 0xff;
76 }
77}
78
79/* Inserts 9 to 16 bits into the output buffer. */
80static void __inline

Callers 1

MPPC_CompressFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected