PHP 8.2.30
Preview: bit-matrix.js Size: 1.47 KB
/home/byroehnu/.trash/node_modules11/qrcode/lib/core/bit-matrix.js

/**
 * Helper class to handle QR Code symbol modules
 *
 * @param {Number} size Symbol size
 */
function BitMatrix (size) {
  if (!size || size < 1) {
    throw new Error('BitMatrix size must be defined and greater than 0')
  }

  this.size = size
  this.data = new Uint8Array(size * size)
  this.reservedBit = new Uint8Array(size * size)
}

/**
 * Set bit value at specified location
 * If reserved flag is set, this bit will be ignored during masking process
 *
 * @param {Number}  row
 * @param {Number}  col
 * @param {Boolean} value
 * @param {Boolean} reserved
 */
BitMatrix.prototype.set = function (row, col, value, reserved) {
  const index = row * this.size + col
  this.data[index] = value
  if (reserved) this.reservedBit[index] = true
}

/**
 * Returns bit value at specified location
 *
 * @param  {Number}  row
 * @param  {Number}  col
 * @return {Boolean}
 */
BitMatrix.prototype.get = function (row, col) {
  return this.data[row * this.size + col]
}

/**
 * Applies xor operator at specified location
 * (used during masking process)
 *
 * @param {Number}  row
 * @param {Number}  col
 * @param {Boolean} value
 */
BitMatrix.prototype.xor = function (row, col, value) {
  this.data[row * this.size + col] ^= value
}

/**
 * Check if bit at specified location is reserved
 *
 * @param {Number}   row
 * @param {Number}   col
 * @return {Boolean}
 */
BitMatrix.prototype.isReserved = function (row, col) {
  return this.reservedBit[row * this.size + col]
}

module.exports = BitMatrix

Directory Contents

Dirs: 0 × Files: 22

Name Size Perms Modified Actions
2.93 KB lrw-r--r-- 2026-02-27 09:44:58
Edit Download
1.78 KB lrw-r--r-- 2026-02-27 09:44:58
Edit Download
719 B lrw-r--r-- 2026-02-27 09:44:58
Edit Download
1.47 KB lrw-r--r-- 2026-02-27 09:44:58
Edit Download
675 B lrw-r--r-- 2026-02-27 09:45:00
Edit Download
3.33 KB lrw-r--r-- 2026-02-27 09:45:00
Edit Download
893 B lrw-r--r-- 2026-02-27 09:45:00
Edit Download
599 B lrw-r--r-- 2026-02-27 09:45:00
Edit Download
1.10 KB lrw-r--r-- 2026-02-27 09:45:00
Edit Download
1.85 KB lrw-r--r-- 2026-02-27 09:45:00
Edit Download
1.55 KB lrw-r--r-- 2026-02-27 09:45:00
Edit Download
5.96 KB lrw-r--r-- 2026-02-27 09:45:00
Edit Download
3.89 KB lrw-r--r-- 2026-02-27 09:45:00
Edit Download
1.18 KB lrw-r--r-- 2026-02-27 09:45:00
Edit Download
1.55 KB lrw-r--r-- 2026-02-27 09:45:00
Edit Download
14.77 KB lrw-r--r-- 2026-02-27 09:45:00
Edit Download
1.59 KB lrw-r--r-- 2026-02-27 09:45:00
Edit Download
1.06 KB lrw-r--r-- 2026-02-27 09:45:02
Edit Download
9.11 KB lrw-r--r-- 2026-02-27 09:45:02
Edit Download
1.58 KB lrw-r--r-- 2026-02-27 09:45:04
Edit Download
268 B lrw-r--r-- 2026-02-27 09:45:04
Edit Download
4.81 KB lrw-r--r-- 2026-02-27 09:45:04
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).