INNER CODE UNIT · TypeScript

bitCount

mongodb/js-bson · src/binary.ts:424

    const bitCount = byteCount * 8 - this.buffer[1];
    const bits = new Int8Array(bitCount);

    for (let bitOffset = 0; bitOffset < bits.length; bitOffset++) {
      const byteOffset = (bitOffset / 8) | 0;
      const byte = this.buffer[byteOffset + 2];
      const shift = 7 - (bitOffset % 8);
      const bit = (byte >> shift) & 1;
      bits[bitOffset] = bit;
    }

    return bits;
  }

  /**
   * Constructs a Binary representing an Int8 Vector.
   * @param array - The array to store as a view on the Binary class
   */

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…