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

Function putbits24

freebsd/net/mppcc.c:106–131  ·  view source on GitHub ↗

Inserts 17 to 24 bits into the output buffer. */

Source from the content-addressed store, hash-verified

104
105/* Inserts 17 to 24 bits into the output buffer. */
106static void __inline
107putbits24(uint8_t *buf, uint32_t val, const uint32_t n, uint32_t *i, uint32_t *l)
108{
109 buf += *i;
110 if (*l >= n - 16) {
111 (*i)++; (*i)++;
112 *l = 16 - n + (*l);
113 val <<= *l;
114 *buf = *buf | ((val >> 16) & 0xff);
115 *(++buf) = (val >> 8) & 0xff;
116 *(++buf) = val & 0xff;
117 if (*l == 0) {
118 *l = 8;
119 (*i)++;
120 *(++buf) = 0;
121 }
122 } else {
123 (*i)++; (*i)++; (*i)++;
124 *l = 24 - n + (*l);
125 val <<= *l;
126 *buf = *buf | ((val >> 24) & 0xff);
127 *(++buf) = (val >> 16) & 0xff;
128 *(++buf) = (val >> 8) & 0xff;
129 *(++buf) = val & 0xff;
130 }
131}
132
133size_t MPPC_SizeOfCompressionHistory(void)
134{

Callers 1

MPPC_CompressFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected