This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { inflateRaw, deflateRaw } from "pako"; | |
// https://en.wikipedia.org/wiki/Run-length_encoding | |
const Z_RLE = 3; | |
class BitArray { | |
constructor(bitSize) { | |
const remainder = Math.min(1, bitSize % 8); | |
const byteSize = Math.floor(bitSize / 8) + remainder; | |
const buffer = new ArrayBuffer(byteSize); |