请牛人帮忙解释下如下代码
static void __inlineputbits8(uint8_t *buf, uint32_t val, const uint32_t n, uint32_t *i, uint32_t *l)
{
buf += *i;
if (*l >= n) {
*l = (*l) - n;
val <<= *l;
*buf = *buf | (val & 0xff);
if (*l == 0) {
*l = 8;
(*i)++;
*(++buf) = 0;
}
} else {
(*i)++;
*l = 8 - n + (*l);
val <<= *l;
*buf = *buf | ((val >> 8) & 0xff);
*(++buf) = val & 0xff;
}
}