本文整理汇总了C#中IInstructionDecoder.DecodeFloat方法的典型用法代码示例。如果您正苦于以下问题:C# IInstructionDecoder.DecodeFloat方法的具体用法?C# IInstructionDecoder.DecodeFloat怎么用?C# IInstructionDecoder.DecodeFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IInstructionDecoder
的用法示例。
在下文中一共展示了IInstructionDecoder.DecodeFloat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Decode
/// <summary>
/// Decodes the specified instruction.
/// </summary>
/// <param name="ctx">The context.</param>
/// <param name="decoder">The instruction decoder, which holds the code stream.</param>
public override void Decode(Context ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
Operand constantValueOperand;
// Opcode specific handling
switch (opcode)
{
case OpCode.Ldc_i4:
{
int i = decoder.DecodeInt();
constantValueOperand = Operand.CreateConstant(BuiltInSigType.Int32, i);
}
break;
case OpCode.Ldc_i4_s:
{
sbyte sb = decoder.DecodeSByte();
constantValueOperand = Operand.CreateConstant(BuiltInSigType.Int32, sb);
}
break;
case OpCode.Ldc_i8:
{
long l = decoder.DecodeLong();
constantValueOperand = Operand.CreateConstant(BuiltInSigType.Int64, l);
}
break;
case OpCode.Ldc_r4:
{
float f = decoder.DecodeFloat();
constantValueOperand = Operand.CreateConstant(BuiltInSigType.Single, f);
}
break;
case OpCode.Ldc_r8:
{
double d = decoder.DecodeDouble();
constantValueOperand = Operand.CreateConstant(BuiltInSigType.Double, d);
}
break;
case OpCode.Ldnull:
constantValueOperand = Operand.GetNull();
break;
case OpCode.Ldc_i4_0:
constantValueOperand = Operand.CreateConstant(0);
break;
case OpCode.Ldc_i4_1:
constantValueOperand = Operand.CreateConstant(1);
break;
case OpCode.Ldc_i4_2:
constantValueOperand = Operand.CreateConstant(2);
break;
case OpCode.Ldc_i4_3:
constantValueOperand = Operand.CreateConstant(3);
break;
case OpCode.Ldc_i4_4:
constantValueOperand = Operand.CreateConstant(4);
break;
case OpCode.Ldc_i4_5:
constantValueOperand = Operand.CreateConstant(5);
break;
case OpCode.Ldc_i4_6:
constantValueOperand = Operand.CreateConstant(6);
break;
case OpCode.Ldc_i4_7:
constantValueOperand = Operand.CreateConstant(7);
break;
case OpCode.Ldc_i4_8:
constantValueOperand = Operand.CreateConstant(8);
break;
case OpCode.Ldc_i4_m1:
constantValueOperand = Operand.CreateConstant(-1);
break;
default:
throw new System.NotImplementedException();
}
ctx.Operand1 = constantValueOperand;
ctx.Result = decoder.Compiler.CreateVirtualRegister(constantValueOperand.Type);
//.........这里部分代码省略.........
示例2: Decode
/// <summary>
/// Decodes the specified instruction.
/// </summary>
/// <param name="ctx">The context.</param>
/// <param name="decoder">The instruction decoder, which holds the code stream.</param>
public override void Decode(Context ctx, IInstructionDecoder decoder)
{
// Decode base classes first
base.Decode(ctx, decoder);
ConstantOperand constantValueOperand;
// Opcode specific handling
switch (opcode)
{
case OpCode.Ldc_i4:
{
int i = decoder.DecodeInt();
constantValueOperand = new ConstantOperand(new SigType(CilElementType.I4), i);
}
break;
case OpCode.Ldc_i4_s:
{
sbyte sb = decoder.DecodeSByte();
constantValueOperand = new ConstantOperand(new SigType(CilElementType.I4), sb);
}
break;
case OpCode.Ldc_i8:
{
long l = decoder.DecodeLong();
constantValueOperand = new ConstantOperand(new SigType(CilElementType.I8), l);
}
break;
case OpCode.Ldc_r4:
{
float f = decoder.DecodeFloat();
constantValueOperand = new ConstantOperand(new SigType(CilElementType.R4), f);
}
break;
case OpCode.Ldc_r8:
{
double d = decoder.DecodeDouble();
constantValueOperand = new ConstantOperand(new SigType(CilElementType.R8), d);
}
break;
case OpCode.Ldnull:
constantValueOperand = ConstantOperand.GetNull();
break;
case OpCode.Ldc_i4_0:
constantValueOperand = ConstantOperand.FromValue(0);
break;
case OpCode.Ldc_i4_1:
constantValueOperand = ConstantOperand.FromValue(1);
break;
case OpCode.Ldc_i4_2:
constantValueOperand = ConstantOperand.FromValue(2);
break;
case OpCode.Ldc_i4_3:
constantValueOperand = ConstantOperand.FromValue(3);
break;
case OpCode.Ldc_i4_4:
constantValueOperand = ConstantOperand.FromValue(4);
break;
case OpCode.Ldc_i4_5:
constantValueOperand = ConstantOperand.FromValue(5);
break;
case OpCode.Ldc_i4_6:
constantValueOperand = ConstantOperand.FromValue(6);
break;
case OpCode.Ldc_i4_7:
constantValueOperand = ConstantOperand.FromValue(7);
break;
case OpCode.Ldc_i4_8:
constantValueOperand = ConstantOperand.FromValue(8);
break;
case OpCode.Ldc_i4_m1:
constantValueOperand = ConstantOperand.FromValue(-1);
break;
default:
throw new System.NotImplementedException();
}
ctx.Operand1 = constantValueOperand;
ctx.Result = decoder.Compiler.CreateTemporary(constantValueOperand.Type);
//.........这里部分代码省略.........