UNPKG

disassembler-x86-intel

Version:

An Intel x86 disassembler, generates assembly from Opcode

15 lines (14 loc) 614 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.convertToTwosComp = void 0; var makeHexLengthEven_1 = require("./makeHexLengthEven"); var makeValueToByte_1 = require("./makeValueToByte"); var convertToTwosComp = function (s) { s = makeHexLengthEven_1.makeHexLengthEven(s); var hexL = s.length; var hex = parseInt(s, 16); var maxHex = parseInt('ffffffff'.slice(0, hexL), 16); var twosC = (maxHex - hex + 1).toString(16).toUpperCase(); return makeValueToByte_1.makeValueToByte(twosC, hexL); }; exports.convertToTwosComp = convertToTwosComp;