本文整理汇总了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;
}