Returns a t-uple with instruction bytes (integers)
499556
def bytes(self):
        
        result = []
        op = self.opcode.split(' ')
        argi = 0

        while op:
            q = op.pop(0)

            if q == 'XX':
                for k in range(self.argbytes[argi] - 1):
                    op.pop(0)

                result.extend(num2bytes(self.argval()[argi], self.argbytes[argi]))
                argi += 1
            else:
                result.append(int(q, 16))  # Add opcode

        if len(result) != self.size:
            raise InternalMismatchSizeError(len(result), self)

        return result
496536
def pull_byte(self, stack_pointer):
        
        addr = stack_pointer.value
        byte = self.memory.read_byte(addr)
#        log.info(
#         log.error(
#            "%x|\tpull $%x from %s stack at $%x\t|%s",
#            self.last_op_address, byte, stack_pointer.name, addr,
#            self.cfg.mem_info.get_shortest(self.last_op_address)
#        )

        # FIXME: self.system_stack_pointer += 1
        stack_pointer.increment(1)

        return byte
188687
def getBytes(self) -> list:
        ''''''
        tmpList = []
        tmpList.extend(_FIRST_INDEX)
        # first append the high byte from the Flags and Length
        # high 4 bit: 0x7 then the bits 8-11(indexes) from _length
        length = self.length - 16
        tmpList.append((0x7 << 4) + (length >> 8))
        # Then append the lower 8 bits from _length
        tmpList.append(length & 0xFF)

        tmpList.extend(self._vector)
        tmpList.extend(self._cid)
        return tmpList
387688
def t_NUMBER(self, t):
        '
        if re.match(r'^(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?(kb|gb|mb|tb|pb|Kb|Gb|Mb|Tb|Pb)?$',t.value):
            multiplyer = 1
            try:
                suffix = (t.value[-2:]).lower()
                if suffix in ['kb']:
                    multiplyer = 1024
                elif suffix in ['mb']:
                    multiplyer = 1024*1024
                elif suffix in ['gb']:
                    multiplyer = 1024*1024*1024
                elif suffix in ['tb']:
                    multiplyer = 1024*1024*1024*1024
                elif suffix in ['pb']:
                    multiplyer = 1024*1024*1024*1024*1024
                
                if multiplyer > 1:
                    t.value = t.value[:-2]
            except:
                pass
            
            try:
                f = float(t.value)
                try:
                    e = int(t.value)
                except ValueError:
                    e = f
                    
                if (e == f):
                    t.value = multiplyer*e
                else:
                    t.value = multiplyer*f
            except ValueError:
                _LOGGER.error("el valor %s no es un numero valido" % t.value)
                t.value = 0
        else:
            t.type = 'STRING'
            
        return t
900269
def int_to_bytes(i, minlen=1, order='big'):  # pragma: no cover
        """"""
        blen = max(minlen, PGPObject.int_byte_len(i), 1)

        if six.PY2:
            r = iter(_ * 8 for _ in (range(blen) if order == 'little' else range(blen - 1, -1, -1)))
            return bytes(bytearray((i >> c) & 0xff for c in r))

        return i.to_bytes(blen, order)
694511
def int_to_bytes(val, bit=32, signed=False, big_endian=True):
    
    val = int(val) #ensure it is an int

    if six.PY3:
        order = 'little'
        if big_endian:
            order = 'big'
        return val.to_bytes(length=bit//8, byteorder=order, signed=signed)

    if bit == 8:
        code = 'B'
    elif bit == 16:
        code = 'H'
    elif bit == 32:
        code = 'I'
    elif bit == 64:
        code = 'Q'
    else:
        raise Exception("int_to_bytes : size parameter value should be 8, 16, 32, or 64")

    if big_endian:
        code = '>'+code
    else:
        code = '<'+code

    if signed or val < 0:
        code = code.lower()

    return struct.pack(code, val)
141293
def _lvard(ins):
    
    output = []

    l = eval(ins.quad[2])  # List of bytes to push
    label = tmp_label()
    offset = int(ins.quad[1])
    tmp = list(ins.quad)
    tmp[1] = label
    ins.quad = tmp
    AT_END.extend(_vard(ins))

    output.append('push ix')
    output.append('pop hl')
    output.append('ld bc, %i' % -offset)
    output.append('add hl, bc')
    output.append('ex de, hl')
    output.append('ld hl, %s' % label)
    output.append('ld bc, %i' % len(l))
    output.append('ldir')

    return output
257146
def write_instruction(fout, start_pos, ins):
    
    opcode, operands = ins.opcode, ins.operands
    fmt_operands = opcode_table[opcode]['operands']

    if ins.wide:
        # The "WIDE" prefix
        fout.write(pack('>B', 0xC4))
        # The real opcode.
        fout.write(pack('>B', opcode))
        fout.write(pack('>H', operands[0].value))
        if opcode == 0x84:
            fout.write(pack('>h', operands[1].value))
    elif fmt_operands:
        # A normal simple opcode with simple operands.
        fout.write(pack('>B', opcode))
        for i, (fmt, _) in enumerate(fmt_operands):
            fout.write(fmt.value.pack(operands[i].value))
    elif opcode == 0xAB:
        # Special case for lookupswitch.
        fout.write(pack('>B', opcode))
        # assemble([
        #     ('lookupswitch', {
        #         2: -3,
        #         4: 5
        #     }, <default>)
        # ])
        padding = 4 - (start_pos + 1) % 4
        padding = padding if padding != 4 else 0
        fout.write(pack(f'{padding}x'))
        fout.write(pack('>ii', operands[1].value, len(operands[0])))
        for key in sorted(operands[0].keys()):
            fout.write(pack('>ii', key, operands[0][key]))
    elif opcode == 0xAA:
        # Special case for table switch.
        fout.write(pack('>B', opcode))
        padding = 4 - (start_pos + 1) % 4
        padding = padding if padding != 4 else 0
        fout.write(pack(f'{padding}x'))
        fout.write(pack(
            f'>iii{len(operands) - 3}i',
            # Default branch offset
            operands[0].value,
            operands[1].value,
            operands[2].value,
            *(o.value for o in operands[3:])
        ))
    else:
        # opcode with no operands.
        fout.write(pack('>B', opcode))
1193387
def get_bytes(s):
    """"""
    if isinstance(s, bytes):
        b = s
    elif isinstance(s, str):
        b = bytes.fromhex(s)
    else:
        raise TypeError("s must be either 'bytes' or 'str'!")

    return b
67448
def parse_instruction(string, location, tokens):
    
    mnemonic_str = tokens.get("mnemonic")
    operands = [op for op in tokens.get("operands", [])]

    instr = ArmInstruction(
        string,
        mnemonic_str["ins"],
        operands,
        arch_info.architecture_mode
    )

    if "cc" in mnemonic_str:
        instr.condition_code = cc_mapper[mnemonic_str["cc"]]

    if "uf" in mnemonic_str:
        instr.update_flags = True

    if "ldm_stm_addr_mode" in mnemonic_str:
        instr.ldm_stm_addr_mode = ldm_stm_am_mapper[mnemonic_str["ldm_stm_addr_mode"]]

    return instr
1122412
def bytes(self, *args):
        
        if len(args) == 1 and isinstance(args[0], BTree.Cursor):
            cur = args[0]
        else:
            cur = self.btree.find('eq', self.makekey(*args))

        if cur:
            return cur.getval()
1223045
def convert_ints_to_bytes(in_ints, num):
    """"""
    out_bytes= b""
    for val in in_ints:
        out_bytes+=struct.pack(mmtf.utils.constants.NUM_DICT[num], val)
    return out_bytes
298522
def bytes(self):
        """"""
        flagByte = 0x00
        messageType = 0
        if self._messageType is not None:
            messageType = self._messageType << 5
        extendedBit = 0 if self._extended is None else self._extended << 4
        hopsMax = 0 if self._hopsMax is None else self._hopsMax
        hopsLeft = 0 if self._hopsLeft is None else (self._hopsLeft << 2)
        flagByte = flagByte | messageType | extendedBit | hopsLeft | hopsMax
        return bytes([flagByte])
1236011
def _double_as_bytes(dval):
    ""
    tmp = list(struct.unpack('8B',struct.pack('d', dval)))
    if not _big_endian:
        tmp.reverse()
    return tmp
136406
def lookup(instruction, instructions = None):
    
    if instructions is None:
        instructions = default_instructions

    if isinstance(instruction, str):
        return instructions[instruction]
    elif hasattr(instruction, "__call__"):
        rev = dict(((v,k) for (k,v) in instructions.items()))
        return rev[instruction]
    else:
        raise errors.MachineError(KeyError("Unknown instruction: %s" %
            str(instruction)))
336476
def convert_bytes_to_ints(in_bytes, num):
    """"""
    dt = numpy.dtype('>i' + str(num))
    return numpy.frombuffer(in_bytes, dt)
555531
def _and32(ins):
    
    op1, op2 = tuple(ins.quad[2:])

    if _int_ops(op1, op2):
        op1, op2 = _int_ops(op1, op2)

        if op2 == 0:  # X and False = False
            if str(op1)[0] == 't':  # a temporary term (stack)
                output = _32bit_oper(op1)  # Remove op1 from the stack
            else:
                output = []
            output.append('xor a')
            output.append('push af')
            return output

            # For X and TRUE = X we do nothing as we have to convert it to boolean
            # which is a rather expensive instruction

    output = _32bit_oper(op1, op2)
    output.append('call __AND32')
    output.append('push af')
    REQUIRES.add('and32.asm')
    return output