| 2212 | } |
| 2213 | |
| 2214 | inline long long getBits(int nBits, long long &c, int &lc, const char *&in) { |
| 2215 | while (lc < nBits) { |
| 2216 | c = (c << 8) | *(reinterpret_cast<const unsigned char *>(in++)); |
| 2217 | lc += 8; |
| 2218 | } |
| 2219 | |
| 2220 | lc -= nBits; |
| 2221 | return (c >> lc) & ((1 << nBits) - 1); |
| 2222 | } |
| 2223 | |
| 2224 | // |
| 2225 | // ENCODING TABLE BUILDING & (UN)PACKING |