{"ast":null,"code":"function BitBuffer() {\n  this.buffer = [];\n  this.length = 0;\n}\nBitBuffer.prototype = {\n  get: function (index) {\n    const bufIndex = Math.floor(index / 8);\n    return (this.buffer[bufIndex] >>> 7 - index % 8 & 1) === 1;\n  },\n  put: function (num, length) {\n    for (let i = 0; i < length; i++) {\n      this.putBit((num >>> length - i - 1 & 1) === 1);\n    }\n  },\n  getLengthInBits: function () {\n    return this.length;\n  },\n  putBit: function (bit) {\n    const bufIndex = Math.floor(this.length / 8);\n    if (this.buffer.length <= bufIndex) {\n      this.buffer.push(0);\n    }\n    if (bit) {\n      this.buffer[bufIndex] |= 0x80 >>> this.length % 8;\n    }\n    this.length++;\n  }\n};\nmodule.exports = BitBuffer;","map":null,"metadata":{},"sourceType":"script","externalDependencies":[]}