INNER CODE UNIT · TypeScript

shift

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

      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
   */
  public static fromInt8Array(array: Int8Array): Binary {
    const buffer = ByteUtils.allocate(array.byteLength + 2);
    buffer[0] = Binary.VECTOR_TYPE.Int8;
    buffer[1] = 0;
    const intBytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
    buffer.set(intBytes, 2);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…