AsmResolver.X86.X86Instruction.ComputeSize C# (CSharp) Method

ComputeSize() public method

Computes the size (in bytes) of the instruction.
public ComputeSize ( ) : int
return int
        public int ComputeSize()
        {
            int size = 1; // TODO: multi-byte opcodes.

            size += OpCode.HasRegisterToken ? 1 : 0;

            if (Operand1 != null)
            {
                int mnemonicIndex = Array.IndexOf(OpCode.Mnemonics, Mnemonic);

                size += GetTotalOperandSize(OpCode.OperandTypes1[mnemonicIndex], OpCode.OperandSizes1[mnemonicIndex], Operand1);
                if (Operand2 != null)
                    size += GetTotalOperandSize(OpCode.OperandTypes2[mnemonicIndex], OpCode.OperandSizes2[mnemonicIndex], Operand2);
            }

            return size;
        }