2018-05-23 19:59:57 +02:00
|
|
|
/**
|
|
|
|
* @author n1474335 [n1474335@gmail.com]
|
|
|
|
* @copyright Crown Copyright 2016
|
|
|
|
* @license Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2019-07-09 13:23:59 +02:00
|
|
|
import Operation from "../Operation.mjs";
|
|
|
|
import { bitOp, not } from "../lib/BitwiseOp.mjs";
|
2018-05-23 19:59:57 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* NOT operation
|
|
|
|
*/
|
|
|
|
class NOT extends Operation {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* NOT constructor
|
|
|
|
*/
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
|
|
|
|
this.name = "NOT";
|
|
|
|
this.module = "Default";
|
|
|
|
this.description = "Returns the inverse of each byte.";
|
2018-08-21 20:07:13 +02:00
|
|
|
this.infoURL = "https://wikipedia.org/wiki/Bitwise_operation#NOT";
|
2019-07-29 18:09:46 +02:00
|
|
|
this.inputType = "ArrayBuffer";
|
2018-05-23 19:59:57 +02:00
|
|
|
this.outputType = "byteArray";
|
|
|
|
this.args = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-07-29 18:09:46 +02:00
|
|
|
* @param {ArrayBuffer} input
|
2018-05-23 19:59:57 +02:00
|
|
|
* @param {Object[]} args
|
|
|
|
* @returns {byteArray}
|
|
|
|
*/
|
|
|
|
run(input, args) {
|
2019-07-29 18:09:46 +02:00
|
|
|
input = new Uint8Array(input);
|
2018-05-23 19:59:57 +02:00
|
|
|
return bitOp(input, null, not);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Highlight NOT
|
|
|
|
*
|
|
|
|
* @param {Object[]} pos
|
|
|
|
* @param {number} pos[].start
|
|
|
|
* @param {number} pos[].end
|
|
|
|
* @param {Object[]} args
|
|
|
|
* @returns {Object[]} pos
|
|
|
|
*/
|
|
|
|
highlight(pos, args) {
|
|
|
|
return pos;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Highlight NOT in reverse
|
|
|
|
*
|
|
|
|
* @param {Object[]} pos
|
|
|
|
* @param {number} pos[].start
|
|
|
|
* @param {number} pos[].end
|
|
|
|
* @param {Object[]} args
|
|
|
|
* @returns {Object[]} pos
|
|
|
|
*/
|
|
|
|
highlightReverse(pos, args) {
|
|
|
|
return pos;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export default NOT;
|