MCPcopy Index your code
hub / github.com/zxing-js/library / convertBoolArrayToByteArray

Method convertBoolArrayToByteArray

src/core/aztec/decoder/Decoder.ts:358–364  ·  view source on GitHub ↗

* Packs a bit array into bytes, most significant bit first

(boolArr: boolean[])

Source from the content-addressed store, hash-verified

356 * Packs a bit array into bytes, most significant bit first
357 */
358 public static convertBoolArrayToByteArray(boolArr: boolean[]): Uint8Array {
359 let byteArr = new Uint8Array((boolArr.length + 7) / 8);
360 for (let i = 0; i < byteArr.length; i++) {
361 byteArr[i] = Decoder.readByte(boolArr, 8 * i);
362 }
363 return byteArr;
364 }
365
366 private totalBitsInLayer(layers: number, compact: boolean): number {
367 return ((compact ? 88 : 112) + 16 * layers) * layers;

Callers 2

decodeMethod · 0.80
Decoder.spec.tsFile · 0.80

Calls 1

readByteMethod · 0.80

Tested by

no test coverage detected