本文整理汇总了C#中Mono.Cecil.Cil.Instruction.IsLdcR方法的典型用法代码示例。如果您正苦于以下问题:C# Instruction.IsLdcR方法的具体用法?C# Instruction.IsLdcR怎么用?C# Instruction.IsLdcR使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Cecil.Cil.Instruction
的用法示例。
在下文中一共展示了Instruction.IsLdcR方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsOpCodeSettingOutputParameterToDefaultValue
private static bool IsOpCodeSettingOutputParameterToDefaultValue(Instruction instruction)
{
if (instruction.Next.IsStindI()
&& instruction.IsLdcI()
&& instruction.GetLongValue() == 0L)
{
return true;
}
if (instruction.IsStindI()
&& instruction.Previous.IsLdcI()
&& instruction.Previous.GetLongValue() == 0L)
{
return true;
}
if (instruction.Next.IsStindR()
&& instruction.IsLdcR()
// ReSharper disable CompareOfFloatsByEqualityOperator
&& instruction.GetLongValue() == 0D)
// ReSharper restore CompareOfFloatsByEqualityOperator
{
return true;
}
if (instruction.IsStindR()
&& instruction.Previous.IsLdcR()
// ReSharper disable CompareOfFloatsByEqualityOperator
&& instruction.Previous.GetLongValue() == 0D)
// ReSharper restore CompareOfFloatsByEqualityOperator
{
return true;
}
if (instruction.OpCode == OpCodes.Ldnull
&& instruction.Next.OpCode == OpCodes.Stind_Ref)
{
return true;
}
if (instruction.Next.OpCode == OpCodes.Ldnull
&& instruction.Next.Next.OpCode == OpCodes.Stind_Ref)
{
return true;
}
if (instruction.OpCode == OpCodes.Stind_Ref
&& instruction.Previous.OpCode == OpCodes.Ldnull)
{
return true;
}
return false;
}
示例2: IsOpCodeSettingLocalVariableToDefaultValue
private static bool IsOpCodeSettingLocalVariableToDefaultValue(Instruction instruction)
{
if (instruction.Next.OpCode == OpCodes.Stloc
&& instruction.IsLdcI()
&& instruction.GetLongValue() == 0L)
{
return true;
}
if (instruction.OpCode == OpCodes.Stloc
&& instruction.Previous.IsLdcI()
&& instruction.Previous.GetLongValue() == 0L)
{
return true;
}
if (instruction.Next.OpCode == OpCodes.Stloc
&& instruction.IsLdcR()
// ReSharper disable CompareOfFloatsByEqualityOperator
&& instruction.GetDoubleValue() == 0D)
// ReSharper restore CompareOfFloatsByEqualityOperator
{
return true;
}
if (instruction.OpCode == OpCodes.Stloc
&& instruction.Previous.IsLdcR()
// ReSharper disable CompareOfFloatsByEqualityOperator
&& instruction.Previous.GetDoubleValue() == 0D)
// ReSharper restore CompareOfFloatsByEqualityOperator
{
return true;
}
if (instruction.OpCode == OpCodes.Stobj
&& instruction.Previous.OpCode == OpCodes.Ldnull
&& instruction.Previous.Previous.OpCode == OpCodes.Ldloca)
{
return true;
}
return false;
}