UNPKG

node-noise

Version:
20 lines 605 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.xor = void 0; var alloc_1 = require("./alloc"); var as_uint8array_1 = require("./util/as-uint8array"); /** * Returns the xor distance between two arrays */ function xor(a, b) { if (a.length !== b.length) { throw new Error('Inputs should have the same length'); } var result = (0, alloc_1.allocUnsafe)(a.length); for (var i = 0; i < a.length; i++) { result[i] = a[i] ^ b[i]; } return (0, as_uint8array_1.asUint8Array)(result); } exports.xor = xor; //# sourceMappingURL=xor.js.map