All files / platform/core/src/utils/metadataProvider unpackOverlay.js

0% Statements 0/8
100% Branches 0/0
0% Functions 0/1
0% Lines 0/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13                         
export default function unpackOverlay(arrayBuffer) {
  const bitArray = new Uint8Array(arrayBuffer);
  const byteArray = new Uint8Array(8 * bitArray.length);
 
  for (let byteIndex = 0; byteIndex < byteArray.length; byteIndex++) {
    const bitIndex = byteIndex % 8;
    const bitByteIndex = Math.floor(byteIndex / 8);
    byteArray[byteIndex] = 1 * ((bitArray[bitByteIndex] & (1 << bitIndex)) >> bitIndex);
  }
 
  return byteArray;
}