本文整理匯總了C#中Mono.Cecil.Cil.Instruction.GetSize方法的典型用法代碼示例。如果您正苦於以下問題:C# Instruction.GetSize方法的具體用法?C# Instruction.GetSize怎麽用?C# Instruction.GetSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Mono.Cecil.Cil.Instruction
的用法示例。
在下文中一共展示了Instruction.GetSize方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ToNop
public static int ToNop(ILProcessor ilp, Instruction ins, bool sameSize)
{
if (ins == null) return 0;
int size = ins.GetSize();
ins.OpCode = OpCodes.Nop;
ins.Operand = null;
if (sameSize)
{
for (int i = 1; i < size; i++)
{
Instruction newIns = ilp.Create(OpCodes.Nop);
ilp.InsertAfter(ins, newIns);
}
}
else
{
size = 1;
}
return size;
}
示例2: readShortInlineBrTarget
protected virtual int readShortInlineBrTarget(Instruction instr)
{
return currentOffset + instr.GetSize() + reader.ReadSByte();
}
示例3: ComputeOffsets
/// <summary>
/// Update the offsets of all instructions following the given instruction.
/// </summary>
private static void ComputeOffsets(Instruction instruction)
{
var offset = instruction.Offset;
while (instruction != null)
{
instruction.Offset = offset;
offset += instruction.GetSize();
instruction = instruction.Next;
}
}
示例4: getInstructionSize
static int getInstructionSize(Instruction instr)
{
var opcode = instr.OpCode;
if (opcode == null)
return 5; // Load store/field
var op = instr.Operand as SwitchTargetDisplOperand;
if (op == null)
return instr.GetSize();
return instr.OpCode.Size + (op.targetDisplacements.Length + 1) * 4;
}