From 707abf5e8fa660696d49de63739f32856a229df9 Mon Sep 17 00:00:00 2001 From: Macide Celik Date: Mon, 28 Oct 2019 11:00:09 +0300 Subject: [PATCH] Delete BitShiftRight.mjs --- src/core/operations/BitShiftRight.mjs | 84 --------------------------- 1 file changed, 84 deletions(-) delete mode 100644 src/core/operations/BitShiftRight.mjs diff --git a/src/core/operations/BitShiftRight.mjs b/src/core/operations/BitShiftRight.mjs deleted file mode 100644 index 2d70849e..00000000 --- a/src/core/operations/BitShiftRight.mjs +++ /dev/null @@ -1,84 +0,0 @@ -/** - * @author n1474335 [n1474335@gmail.com] - * @copyright Crown Copyright 2016 - * @license Apache-2.0 - */ - -import Operation from "../Operation.mjs"; - -/** - * Bit shift right operation - */ -class BitShiftRight extends Operation { - - /** - * BitShiftRight constructor - */ - constructor() { - super(); - - this.name = "Bit shift right"; - this.module = "Default"; - this.description = "Shifts the bits in each byte towards the right by the specified amount.

Logical shifts replace the leftmost bits with zeros.
Arithmetic shifts preserve the most significant bit (MSB) of the original byte keeping the sign the same (positive or negative)."; - this.infoURL = "https://wikipedia.org/wiki/Bitwise_operation#Bit_shifts"; - this.inputType = "ArrayBuffer"; - this.outputType = "ArrayBuffer"; - this.args = [ - { - "name": "Amount", - "type": "number", - "value": 1 - }, - { - "name": "Type", - "type": "option", - "value": ["Logical shift", "Arithmetic shift"] - } - ]; - } - - /** - * @param {ArrayBuffer} input - * @param {Object[]} args - * @returns {ArrayBuffer} - */ - run(input, args) { - const amount = args[0], - type = args[1], - mask = type === "Logical shift" ? 0 : 0x80; - input = new Uint8Array(input); - - return input.map(b => { - return (b >>> amount) ^ (b & mask); - }).buffer; - } - - /** - * Highlight Bit shift right - * - * @param {Object[]} pos - * @param {number} pos[].start - * @param {number} pos[].end - * @param {Object[]} args - * @returns {Object[]} pos - */ - highlight(pos, args) { - return pos; - } - - /** - * Highlight Bit shift right 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 BitShiftRight;