• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Operand类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Operand的典型用法代码示例。如果您正苦于以下问题:C# Operand类的具体用法?C# Operand怎么用?C# Operand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Operand类属于命名空间,在下文中一共展示了Operand类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Instruction

 public Instruction(Mnemonic mnemonic, Operand? operand, byte opcode, int length)
 {
     this.Mnemonic = mnemonic;
     this.Operand = operand;
     this.Opcode = opcode;
     this.Length = length;
 }
开发者ID:Romfos,项目名称:MOS6502,代码行数:7,代码来源:Instruction.cs


示例2: ComputeOpCode

        /// <summary>
        /// 
        /// </summary>
        /// <param name="destination"></param>
        /// <param name="source"></param>
        /// <param name="third"></param>
        /// <returns></returns>
        protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third)
        {
            if (source.Type.Type == CilElementType.R4)
                return R4;

            return R8;
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:14,代码来源:SseRoundInstruction.cs


示例3: Calculate

        /// <summary>
        /// Builds up an expression to divide the left operand by the right operand.
        /// </summary>
        /// <param name="left">The left operand.</param>
        /// <param name="right">The right operand.</param>
        /// <returns>The operand that consists of the expression to divide the left operand by the right operand.</returns>
        public override Operand Calculate(Operand left, Operand right)
        {
            Logger.Info("Dividing operands (left = '{0}', right = '{1}').", left.OperandType.FullName, right.OperandType.FullName);

            Operand result = null;

            var operands = new OperandPair(left, right);
            if (operands.Are(typeof(decimal)))
            {
                result = new Operand(Expression.Divide(left.Expression, right.Expression), typeof(decimal));
            }
            else
            {
                Warn("'{0}' doesn't support to divide '{1}' and '{2}'.", GetType().FullName, left.OperandType.FullName, right.OperandType.FullName);

                var l = Expression.Call(null, typeof(Convert).GetMethod("ToString", new Type[] { typeof(object) }), Expression.Convert(left.Expression, typeof(object)));
                var r = Expression.Call(null, typeof(Convert).GetMethod("ToString", new Type[] { typeof(object) }), Expression.Convert(right.Expression, typeof(object)));
                var method = typeof(string).GetMethod("Concat", BindingFlags.Static | BindingFlags.Public, null, new Type[] { typeof(string), typeof(string), typeof(string) }, null);
                result = new Operand(Expression.Call(null, method, l, Expression.Constant(Symbol), r), typeof(string));
            }

            Logger.Info("Divided operands (result = '{0}').", result.OperandType.FullName);

            return result;
        }
开发者ID:kennedykinyanjui,项目名称:Projects,代码行数:31,代码来源:Divide.cs


示例4: ComputeOpCode

        /// <summary>
        /// Computes the opcode.
        /// </summary>
        /// <param name="destination">The destination operand.</param>
        /// <param name="source">The source operand.</param>
        /// <param name="third">The third operand.</param>
        /// <returns></returns>
        protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third)
        {
            if ((destination is MemoryOperand) && (source is RegisterOperand))
            {
                if (IsByte(destination) || IsByte(source))
                    return M_R_8;
                if (IsChar(destination) || IsChar(source))
                    return M_R_16;
                return M_R;
            }

            if ((destination is RegisterOperand) && (source is MemoryOperand))
            {
                if (IsByte(source) || IsByte(destination))
                    return R_M_8;
                if (IsChar(source) || IsShort(source))
                    return R_M_16;
                return R_M;
            }

            if ((destination is RegisterOperand) && (source is RegisterOperand)) return R_R;
            if ((destination is MemoryOperand) && (source is ConstantOperand)) return M_C;
            if ((destination is RegisterOperand) && (source is ConstantOperand))
            {
                if (IsByte(source) || IsByte(destination))
                    return R_C_8;
                if (IsChar(source) || IsShort(source))
                    return R_C_16;
                return R_C;
            }

            throw new ArgumentException(String.Format(@"x86.CmpInstruction: No opcode for operand types {0} and {1}.", destination, source));
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:40,代码来源:CmpInstruction.cs


示例5: ComputeOpCode

 /// <summary>
 /// Computes the opcode.
 /// </summary>
 /// <param name="destination">The destination operand.</param>
 /// <param name="source">The source operand.</param>
 /// <param name="third">The third operand.</param>
 /// <returns></returns>
 protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third)
 {
     if ((destination is RegisterOperand) && (source is LabelOperand)) return opcode;
     if ((destination is RegisterOperand) && (source is RegisterOperand)) return opcode;
     if ((destination is RegisterOperand) && (source is MemoryOperand)) return opcode;
     throw new ArgumentException(@"No opcode for operand type.");
 }
开发者ID:rtownsend,项目名称:MOSA-Project,代码行数:14,代码来源:Cvtss2sdInstruction.cs


示例6: Internal

        /// <summary>
        /// Allows quick internal call replacements
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="methodCompiler">The method compiler.</param>
        /// <param name="internalMethod">The internal method to replace with.</param>
        /// <param name="internalClass">The internal class that has the internal method.</param>
        protected void Internal(Context context, BaseMethodCompiler methodCompiler, string internalMethod, string internalClass = "Internal")
        {
            if (context == null || methodCompiler == null || internalMethod == null || internalClass == null)
                throw new ArgumentNullException();

            var type = methodCompiler.TypeSystem.GetTypeByName("Mosa.Runtime", internalClass);
            Debug.Assert(type != null, "Cannot find Mosa.Runtime." + internalClass);

            var method = type.FindMethodByName(internalMethod);
            Debug.Assert(method != null, "Cannot find " + internalMethod + " in " + type.Name);

            Operand callTargetOperand = Operand.CreateSymbolFromMethod(methodCompiler.TypeSystem, method);

            var operands = new Operand[context.OperandCount];

            for (int i = 0; i < context.OperandCount; i++)
                operands[i] = context.GetOperand(i);

            Operand result = context.Result;

            context.SetInstruction(IRInstruction.Call, result, callTargetOperand);

            for (int i = 0; i < operands.Length; i++)
            {
                context.SetOperand(1 + i, operands[i]);
            }

            context.OperandCount = (byte)(1 + operands.Length);
            context.InvokeMethod = method;
        }
开发者ID:Zahovay,项目名称:MOSA-Project,代码行数:37,代码来源:InternalsBase.cs


示例7: ComputeOpCode

        /// <summary>
        /// Computes the opcode.
        /// </summary>
        /// <param name="destination">The destination operand.</param>
        /// <param name="source">The source operand.</param>
        /// <param name="third">The third operand.</param>
        /// <returns></returns>
        protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third)
        {
            //if (source.Type.Type == CilElementType.R4) return DIVSS;
            return opcode;

            //return DIVSD;
        }
开发者ID:grover,项目名称:MOSA-Project,代码行数:14,代码来源:DivSS.cs


示例8: ComputeOpCode

        /// <summary>
        /// Computes the opcode.
        /// </summary>
        /// <param name="destination">The destination operand.</param>
        /// <param name="source">The source operand.</param>
        /// <param name="third">The third operand.</param>
        /// <returns></returns>
        protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third)
        {
            if ((destination is MemoryOperand) && (source is RegisterOperand))
            {
                if (IsByte (destination) || IsByte (source))
                    return M_R_8;
                if (IsChar (destination) || IsChar (source))
                    return M_R_16;
                return M_R;
            }

            if ((destination is RegisterOperand) && (source is MemoryOperand))
            {
                if (IsByte (source) || IsByte (destination))
                    return R_M_8;
                if (IsChar (source) || IsShort (source))
                    return R_M_16;
                return R_M;
            }

            if ((destination is RegisterOperand) && (source is RegisterOperand))
                return R_R;
            if ((destination is MemoryOperand) && (source is ConstantOperand))
                return M_C;
            if ((destination is RegisterOperand) && (source is ConstantOperand))
            {
                if (IsByte (source) || IsByte (destination))
                    return R_C_8;
                if (IsChar (source) || IsShort (source))
                    return R_C_16;
                return R_C;
            }
            throw new ArgumentException ("No opcode for operand type.");
        }
开发者ID:hj1980,项目名称:Mosa,代码行数:41,代码来源:DirectCompareInstruction.cs


示例9: ConversationWrapper

 public ConversationWrapper(Conversion conv, Operand op, Type @from, Type to)
 {
     _conv = conv;
     _op = op;
     _to = to;
     _from = @from;
 }
开发者ID:AqlaSolutions,项目名称:runsharp,代码行数:7,代码来源:ConversationWrapper.cs


示例10: Awake

 //FUNCTIONS
 void Awake()
 {
     base.initialize(); //this calls initialization stuff inside the Symbol class
     operand = transform.parent.GetComponent<Operand>(); //refernce to parent Operand
     Debug.Log("Operand: " + operand);
     _padding = 0;
 }
开发者ID:katieyang,项目名称:ToQ,代码行数:8,代码来源:Operator.cs


示例11: SafeCast

 public SafeCast(Operand op, Type t)
 {
     _op = op;
     _t = t;
     if (t.IsValueType)
         _conditional = _op.Is(_t).Conditional(_op.Cast(_t), new DefaultValue(_t));
 }
开发者ID:AqlaSolutions,项目名称:runsharp,代码行数:7,代码来源:SafeCast.cs


示例12: EmitFloatingPointConstant

        /// <summary>
        /// This function emits a constant variable into the read-only data section.
        /// </summary>
        /// <param name="operand">The operand.</param>
        /// <returns>
        /// An operand, which represents the reference to the read-only constant.
        /// </returns>
        protected Operand EmitFloatingPointConstant(Operand operand)
        {
            if (!operand.IsConstant || !operand.IsR)
                return operand;

            int size, alignment;
            Architecture.GetTypeRequirements(TypeLayout, operand.Type, out size, out alignment);

            string name = String.Format("C_{0}", Guid.NewGuid());

            using (Stream stream = MethodCompiler.Linker.Allocate(name, SectionKind.ROData, size, alignment))
            {
                using (BinaryWriter writer = new BinaryWriter(stream))
                {
                    if (operand.IsR4)
                    {
                        writer.Write(operand.ConstantSingleFloatingPoint);
                    }
                    else if (operand.IsR8)
                    {
                        writer.Write(operand.ConstantDoubleFloatingPoint);
                    }
                }
            }

            return Operand.CreateLabel(operand.Type, name);
        }
开发者ID:tea,项目名称:MOSA-Project,代码行数:34,代码来源:BasePlatformTransformationStage.cs


示例13: AssemblerInstruction

 public AssemblerInstruction(int line, Opcode opcode, Operand left, Operand right)
 {
     Line = line;
     Opcode = opcode;
     Left = left;
     Right = right;
 }
开发者ID:Rohansi,项目名称:Programe,代码行数:7,代码来源:AssemblerInstruction.cs


示例14: ComputeOpCode

        /// <summary>
        /// Computes the opcode.
        /// </summary>
        /// <param name="destination">The destination operand.</param>
        /// <param name="source">The source operand.</param>
        /// <param name="third">The third operand.</param>
        /// <returns></returns>
        protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third)
        {
            if (destination is RegisterOperand)
                if ((destination as RegisterOperand).Register is ControlRegister) return CR_R;
                else if ((destination as RegisterOperand).Register is SegmentRegister)
                    throw new ArgumentException(@"TODO: No opcode for move to segment register");

            if (source is RegisterOperand)
                if ((source as RegisterOperand).Register is ControlRegister) return R_CR;
                else if ((source as RegisterOperand).Register is SegmentRegister)
                    throw new ArgumentException(@"TODO: No opcode for move from segment register");

            if ((destination is RegisterOperand) && (source is ConstantOperand)) return R_C;
            if ((destination is MemoryOperand) && (source is ConstantOperand)) return M_C;
            if ((destination is RegisterOperand) && (source is LabelOperand)) return R_C;
            if ((destination is MemoryOperand) && (source is LabelOperand)) return M_C;

            if ((destination is RegisterOperand) && (source is RegisterOperand)) {
                if (IsByte(source) || IsByte(destination)) return R_R_U8;
                if (IsChar(source) || IsChar(destination) || IsShort(source) || IsShort(destination)) return R_R_16;
                return R_R;
            }
            if ((destination is RegisterOperand) && (source is MemoryOperand)) {
                if (IsByte(destination)) return R_M_U8;
                if (IsChar(destination) || IsShort(destination)) return R_M_16;
                return R_M;
            }
            if ((destination is MemoryOperand) && (source is RegisterOperand)) {
                if (IsByte(destination)) return M_R_U8;
                if (IsChar(destination) || IsShort(destination)) return M_R_16;
                return M_R;
            }

            throw new ArgumentException(@"No opcode for operand type. [" + destination.GetType() + ", " + source.GetType() + ")");
        }
开发者ID:shanebrown99,项目名称:MOSA-Project,代码行数:42,代码来源:MovInstruction.cs


示例15: Is32Bit

 /// <summary>
 /// Determines whether the specified operand is 32 bits.
 /// </summary>
 /// <param name="operand">The operand.</param>
 /// <returns></returns>
 protected static bool Is32Bit(Operand operand)
 {
     return (operand.Type.Type == CilElementType.U4)
         || (operand.Type.Type == CilElementType.I4)
         || IsPointer(operand)
         || IsObject(operand);
 }
开发者ID:jeffreye,项目名称:MOSA-Project,代码行数:12,代码来源:BasePlatformTransformationStage.cs


示例16: NotImplementedException

        void IIntrinsicSupport.EmitInstruction(InstructionCode code, Operand operand0, Operand operand1)
        {
            Contract.Requires(operand0 != null);
            Contract.Requires(operand1 != null);

            throw new NotImplementedException();
        }
开发者ID:modulexcite,项目名称:nasmjit,代码行数:7,代码来源:IIntrinsicSupportContracts.cs


示例17: ComputeOpCode

        /// <summary>
        /// Computes the opcode.
        /// </summary>
        /// <param name="destination">The destination operand.</param>
        /// <param name="source">The source operand.</param>
        /// <param name="third">The third operand.</param>
        /// <returns></returns>
        protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third)
        {
            if (destination == null || destination is RegisterOperand || destination is MemoryOperand)
                return DIV;

            throw new ArgumentException ("No opcode for operand type.");
        }
开发者ID:hj1980,项目名称:Mosa,代码行数:14,代码来源:DivInstruction.cs


示例18: Instruction

 public Instruction(Mnemonic mnemonic, Operand[] operands, byte[] opcode, int length)
 {
     this.Mnemonic = mnemonic;
     this.Operands = operands;
     this.Opcode = opcode;
     this.Length = length;
 }
开发者ID:Romfos,项目名称:Netasm-old,代码行数:7,代码来源:Instruction.cs


示例19: ComputeOpCode

        /// <summary>
        /// Computes the opcode.
        /// </summary>
        /// <param name="destination">The destination operand.</param>
        /// <param name="source">The source operand.</param>
        /// <param name="third">The third operand.</param>
        /// <returns></returns>
        protected override OpCode ComputeOpCode(Operand destination, Operand source, Operand third)
        {
            if (!(destination is RegisterOperand))
                throw new ArgumentException(@"Destination must be RegisterOperand.", @"destination");
            if (source is ConstantOperand)
                throw new ArgumentException(@"Source must not be ConstantOperand.", @"source");

            switch (source.Type.Type) {
                case CilElementType.U1: goto case CilElementType.I1;
                case CilElementType.I1: {
                        if ((destination is RegisterOperand) && (source is RegisterOperand)) return R_X8;
                        if ((destination is RegisterOperand) && (source is MemoryOperand)) return R_X8;
                    }
                    break;
                case CilElementType.Char: goto case CilElementType.U2;
                case CilElementType.U2: goto case CilElementType.I2;
                case CilElementType.I2:
                    if ((destination is RegisterOperand) && (source is RegisterOperand)) return R_X16;
                    if ((destination is RegisterOperand) && (source is MemoryOperand)) return R_X16;
                    break;
                case CilElementType.Boolean: goto case CilElementType.I1;
                default:

                    break;
            }

            throw new ArgumentException(@"No opcode for operand type. [" + destination.GetType() + ", " + source.GetType() + ")");
        }
开发者ID:shanebrown99,项目名称:MOSA-Project,代码行数:35,代码来源:MovzxInstruction.cs


示例20: HandleMemoryToMemoryOperation

        private void HandleMemoryToMemoryOperation(Context ctx, Operand register, bool useStack)
        {
            Operand destination = ctx.Result;
            Operand source = ctx.Operand1;

            Debug.Assert (destination is MemoryOperand && source is MemoryOperand);

            if (register == null)
                register = new RegisterOperand (destination.Type, GeneralPurposeRegister.EDX);

            ctx.Operand1 = register;

            Context before = ctx.InsertBefore ();

            if (useStack)
            {
                before.SetInstruction (CPUx86.Instruction.PushInstruction, null, register);
                before.AppendInstruction (CPUx86.Instruction.MovInstruction, register, source);
            }

            else
                before.SetInstruction (CPUx86.Instruction.MovInstruction, register, source);

            if (useStack)
                ctx.AppendInstruction (CPUx86.Instruction.PopInstruction, register);
        }
开发者ID:54616E6E6572,项目名称:Mosa,代码行数:26,代码来源:MemToMemConversionStage.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# OperandType类代码示例发布时间:2022-05-24
下一篇:
C# OpenedFile类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap