dsc / bitstring.js

Read and write packed binary strings, bit-by-bit, in JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't read long bit length

nickboucher opened this issue · comments

Just as in Issue #4, JS 32-bit limitations for bitwise operations prevent reading bit lengths greater than 31 bits because of the following section of .readbits():

    while (size < n) {
      byte = this._nextbyte();
      if (byte == null) {
        break;
      }
      size += 8;
      // This is the problematic line, since the bitshift value accumulates within the `while` loop
      bits = bits << 8 | byte;
    }