当前位置: 首页>>代码示例>>C#>>正文


C# IInstructionDecoder.DecodeDouble方法代码示例

本文整理汇总了C#中IInstructionDecoder.DecodeDouble方法的典型用法代码示例。如果您正苦于以下问题:C# IInstructionDecoder.DecodeDouble方法的具体用法?C# IInstructionDecoder.DecodeDouble怎么用?C# IInstructionDecoder.DecodeDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IInstructionDecoder的用法示例。


在下文中一共展示了IInstructionDecoder.DecodeDouble方法的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);
//.........这里部分代码省略.........
开发者ID:pdelprat,项目名称:MOSA-Project,代码行数:101,代码来源:LdcInstruction.cs

示例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);
//.........这里部分代码省略.........
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:101,代码来源:LdcInstruction.cs


注:本文中的IInstructionDecoder.DecodeDouble方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。