| 51 | }; |
| 52 | |
| 53 | static uint32_t __inline |
| 54 | getbits(const uint8_t *buf, const uint32_t n, uint32_t *i, uint32_t *l) |
| 55 | { |
| 56 | static const uint32_t m[] = {0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff}; |
| 57 | uint32_t res, ol; |
| 58 | |
| 59 | ol = *l; |
| 60 | if (*l >= n) { |
| 61 | *l = (*l) - n; |
| 62 | res = (buf[*i] & m[ol]) >> (*l); |
| 63 | if (*l == 0) { |
| 64 | *l = 8; |
| 65 | (*i)++; |
| 66 | } |
| 67 | } else { |
| 68 | *l = 8 - n + (*l); |
| 69 | res = (buf[(*i)++] & m[ol]) << 8; |
| 70 | res = (res | buf[*i]) >> (*l); |
| 71 | } |
| 72 | |
| 73 | return (res); |
| 74 | } |
| 75 | |
| 76 | static uint32_t __inline |
| 77 | getbyte(const uint8_t *buf, const uint32_t i, const uint32_t l) |
no outgoing calls
no test coverage detected