static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
{
#ifdef BITSTREAM_READER_LE
    uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1);
    bc->bits >>= n;
#else
    uint64_t ret = bc->bits >> (64 - n);
    bc->bits <<= n;
#endif
    bc->bits_left -= n;
    return ret;
}
['static inline void idx_to_quant(MPCContext *c, BitstreamContext *bc, int idx, int *dst)\n{\n    int i, i1, t;\n    switch(idx){\n    case -1:\n        for(i = 0; i < SAMPLES_PER_BAND; i++){\n            *dst++ = (av_lfg_get(&c->rnd) & 0x3FC) - 510;\n        }\n        break;\n    case 1:\n        i1 = bitstream_read_bit(bc);\n        for(i = 0; i < SAMPLES_PER_BAND/3; i++){\n            t = bitstream_read_vlc(bc, quant_vlc[0][i1].table, 9, 2);\n            *dst++ = mpc7_idx30[t];\n            *dst++ = mpc7_idx31[t];\n            *dst++ = mpc7_idx32[t];\n        }\n        break;\n    case 2:\n        i1 = bitstream_read_bit(bc);\n        for(i = 0; i < SAMPLES_PER_BAND/2; i++){\n            t = bitstream_read_vlc(bc, quant_vlc[1][i1].table, 9, 2);\n            *dst++ = mpc7_idx50[t];\n            *dst++ = mpc7_idx51[t];\n        }\n        break;\n    case  3: case  4: case  5: case  6: case  7:\n        i1 = bitstream_read_bit(bc);\n        for(i = 0; i < SAMPLES_PER_BAND; i++)\n            *dst++ = bitstream_read_vlc(bc, quant_vlc[idx - 1][i1].table, 9, 2) - mpc7_quant_vlc_off[idx - 1];\n        break;\n    case  8: case  9: case 10: case 11: case 12:\n    case 13: case 14: case 15: case 16: case 17:\n        t = (1 << (idx - 2)) - 1;\n        for(i = 0; i < SAMPLES_PER_BAND; i++)\n            *dst++ = bitstream_read(bc, idx - 1) - t;\n        break;\n    default:\n        return;\n    }\n}', 'static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n)\n{\n    if (!n)\n        return 0;\n    if (n > bc->bits_left) {\n        refill_32(bc);\n        if (bc->bits_left < 32)\n            bc->bits_left = n;\n    }\n    return get_val(bc, n);\n}', 'static inline uint64_t get_val(BitstreamContext *bc, unsigned n)\n{\n#ifdef BITSTREAM_READER_LE\n    uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1);\n    bc->bits >>= n;\n#else\n    uint64_t ret = bc->bits >> (64 - n);\n    bc->bits <<= n;\n#endif\n    bc->bits_left -= n;\n    return ret;\n}']