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


C# Constant.ToInt32方法代码示例

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


在下文中一共展示了Constant.ToInt32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ApplyConstants

		public override Constant ApplyConstants(Constant c1, Constant c2)
		{
			try
			{
				return BuildConstant(c1.DataType, c2.DataType, unchecked((int) (c1.ToUInt32() * c2.ToUInt32())));
			}
			catch	//$HACK: sometimes we get -ive numbers here, at which point .NET casts fail; attempt to use signed integers instead.
			{
				return BuildConstant(c1.DataType, c2.DataType, c1.ToInt32() * c1.ToInt32());
			}
		}
开发者ID:killbug2004,项目名称:reko,代码行数:11,代码来源:UMulOperator.cs

示例2: ApplyConstants

		public override Constant ApplyConstants(Constant c1, Constant c2)
		{
            if (!ValidArgs(c1, c2))
                return Constant.Invalid;

            return Constant.Bool(c1.ToInt32() >= c2.ToInt32());
        }
开发者ID:relaxar,项目名称:reko,代码行数:7,代码来源:SignedIntOperators.cs

示例3: ApplyConstants

		public override Constant ApplyConstants(Constant c1, Constant c2)
		{
			return c1.ToInt32() != c2.ToInt32()
				? Constant.True() 
				: Constant.False();

		}
开发者ID:gitter-badger,项目名称:reko,代码行数:7,代码来源:ConditionalOperator.cs

示例4: ApplyConstants

		public override Constant ApplyConstants(Constant c1, Constant c2)
		{
            if (!ValidArgs(c1, c2))
                return Constant.Invalid;
            if (c2.IsIntegerZero)
                return Constant.Invalid;
			return BuildConstant(c1.DataType, c2.DataType, c1.ToInt32() % c2.ToInt32());
		}
开发者ID:relaxar,项目名称:reko,代码行数:8,代码来源:IModOperator.cs

示例5: ApplyConstants

		public override Constant ApplyConstants(Constant c1, Constant c2)
		{
            if (!ValidArgs(c1, c2))
                return Constant.Invalid;
            return c1.ToInt32() != c2.ToInt32()
				? Constant.True() 
				: Constant.False();

		}
开发者ID:relaxar,项目名称:reko,代码行数:9,代码来源:ConditionalOperator.cs

示例6: ApplyConstants

		public override Constant ApplyConstants(Constant c1, Constant c2)
		{
            if (!ValidArgs(c1, c2))
                return Constant.Invalid;

            uint v1 = (uint) c1.ToInt32();
			uint v2 = (uint) c2.ToInt32();
            return Constant.Bool(v1 <= v2);
		}
开发者ID:relaxar,项目名称:reko,代码行数:9,代码来源:UnsignedIntOperators.cs

示例7: Match

		public bool Match(DepositBits dpb)
		{
			this.dpb = dpb;
			cSrc = dpb.Source as Constant;
			if (cSrc == null)
				return false;
			cBits = dpb.InsertedBits as Constant;
			if (cBits != null)
				return true;
			return (cSrc.ToInt32() == 0 && dpb.BitPosition == 0);
		}
开发者ID:killbug2004,项目名称:reko,代码行数:11,代码来源:DpbConstantRule.cs

示例8: FormatSignedValue

		public static string FormatSignedValue(Constant c)
		{
			string s = "+";
			int tmp = c.ToInt32();
			if (tmp < 0)
			{
				s = "-";
				tmp = -tmp;
			}
			return s + tmp.ToString(FormatString(c.DataType));
		}
开发者ID:uxmal,项目名称:reko,代码行数:11,代码来源:MachineOperand.cs

示例9: SetRegister

 public override void SetRegister(RegisterStorage r, Constant v)
 {
     if (v != null && v.IsValid)
     {
         values[r.Number] = (uint) v.ToInt32();
         isValid[r.Number] = true;
     }
     else
     {
         isValid[r.Number] = false;
     }
 }
开发者ID:gh0std4ncer,项目名称:reko,代码行数:12,代码来源:M68kState.cs

示例10: ApplyConstants

		public override Constant ApplyConstants(Constant c1, Constant c2)
		{
			return BuildConstant(c1.DataType, c2.DataType, c1.ToInt32() << c2.ToInt32());
		}
开发者ID:killbug2004,项目名称:reko,代码行数:4,代码来源:ShlOperator.cs

示例11: ApplyConstant

 public override Constant ApplyConstant(Constant c)
 {
     return Constant.Create(c.DataType, ~c.ToInt32());
 }
开发者ID:nemerle,项目名称:reko,代码行数:4,代码来源:UnaryOperator.cs

示例12: HandleAddition

        private RegisterStorage HandleAddition(
			RegisterStorage regIdx,
			RegisterStorage ropDst,
			RegisterStorage ropSrc, 
			Constant immSrc, 
			bool add)
		{
			if (ropSrc != null && immSrc == null)
			{
				if (ropSrc == ropDst && add)
				{
					Operations.Add(new BackwalkOperation(BackwalkOperator.mul, 2));
                    Stride *= 2;
					return ropSrc;
				}		
				else
				{
					return null;
				}
			} 
			
            if (immSrc != null)
			{
                if (!add && UsedAsFlag == IndexExpression)
                {
                    Operations.Add(
                        new BackwalkOperation(
                            BackwalkOperator.cmp,
                            immSrc.ToInt32()));
                }
                else
                {
                    Operations.Add(new BackwalkOperation(
                        add ? BackwalkOperator.add : BackwalkOperator.sub,
                        immSrc.ToInt32()));
                }
				return regIdx;
			}
			else
				return null;
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:41,代码来源:Backwalker.cs

示例13: EmitLeImmediate

		public void EmitLeImmediate(Constant c, PrimitiveType dt)
		{
			switch (dt.Size)
			{
			case 1: EmitByte(c.ToInt32()); return;
			case 2: EmitLeUInt16(c.ToInt32()); return;
			case 4: EmitLeUInt32(c.ToUInt32()); return;
			default: throw new NotSupportedException(string.Format("Unsupported type: {0}", dt));
			}
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:10,代码来源:Emitter.cs

示例14: ApplyConstants

		public override Constant ApplyConstants(Constant c1, Constant c2)
		{
			return Constant.Bool(c1.ToInt32() < c2.ToInt32());
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:4,代码来源:RealConditionalOperators.cs

示例15: ApplyConstants

		public override Constant ApplyConstants(Constant c1, Constant c2)
		{
            if (!ValidArgs(c1, c2))
                return Constant.Invalid;
            return BuildConstant(c1.DataType, c2.DataType, (int) (c1.ToUInt32() >> c2.ToInt32()));
		}
开发者ID:relaxar,项目名称:reko,代码行数:6,代码来源:ShrOperator.cs


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