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


C# CodeGen.EmitI4Helper方法代码示例

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


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

示例1: EmitGet

		internal override void EmitGet(CodeGen g)
		{
			g.EmitI4Helper(elements.Length);
			g.IL.Emit(OpCodes.Newarr, type);

			for (int i = 0; i < elements.Length; i++)
			{
				g.IL.Emit(OpCodes.Dup);
				g.EmitI4Helper(i);
				g.EmitStelemHelper(type, elements[i], false);
			}
		}
开发者ID:amithasan,项目名称:Framework-Class-Library-Extension,代码行数:12,代码来源:InitializedArray.cs

示例2: EmitGet

		protected internal override void EmitGet(CodeGen g)  
        {
		    OperandExtensions.SetLeakedState(this, false); 
			Type t = Helpers.GetEnumEnderlyingType(GetReturnType(g.TypeMapper));
			if (Helpers.AreTypesEqual(t, typeof(long), g.TypeMapper))
				g.EmitI8Helper(Convert.ToInt64(_value, null), true);
			else if (Helpers.AreTypesEqual(t, typeof(ulong), g.TypeMapper))
                g.EmitI8Helper(unchecked((long)Convert.ToUInt64(_value, null)), false);
			else if (Helpers.AreTypesEqual(t, typeof(uint), g.TypeMapper))
                g.EmitI4Helper(unchecked((int)Convert.ToUInt32(_value, null)));
			else
				g.EmitI4Helper(Convert.ToInt32(_value, null));
		}
开发者ID:AqlaSolutions,项目名称:runsharp,代码行数:13,代码来源:EnumLiteral.cs

示例3: EmitGet

		protected internal override void EmitGet(CodeGen g)  
        {
		    OperandExtensions.SetLeakedState(this, false); 
			g.EmitI4Helper(_elements.Length);
			g.IL.Emit(OpCodes.Newarr, _type);

			for (int i = 0; i < _elements.Length; i++)
			{
				g.IL.Emit(OpCodes.Dup);
				g.EmitI4Helper(i);
				g.EmitStelemHelper(_type, _elements[i], false);
			}
		}
开发者ID:AqlaSolutions,项目名称:runsharp,代码行数:13,代码来源:InitializedArray.cs

示例4: EmitGet

		internal override void EmitGet(CodeGen g)
		{
			int[] bits = decimal.GetBits(value);
			byte exponent = unchecked((byte)((bits[3] >> 16) & 0x1f));
			bool sign = bits[3] < 0;

			if (exponent == 0 && bits[2] == 0)
			{
				if (bits[1] == 0 && (bits[0] > 0 || (bits[0] == 0 && !sign)))	// fits in int32 - use the basic int constructor
				{
					g.EmitI4Helper(sign ? -bits[0] : bits[0]);
					g.IL.Emit(OpCodes.Newobj, decimalIntConstructor);
					return;
				}
				if (bits[1] > 0)	// fits in int64
				{
					long l = unchecked((long)(((ulong)(uint)bits[1] << 32) | (ulong)(uint)bits[0]));
					g.IL.Emit(OpCodes.Ldc_I8, sign ? -l : l);
					g.IL.Emit(OpCodes.Newobj, decimalLongConstructor);
					return;
				}
			}

			g.EmitI4Helper(bits[0]);
			g.EmitI4Helper(bits[1]);
			g.EmitI4Helper(bits[2]);
			g.EmitI4Helper(sign ? 1 : 0);
			g.EmitI4Helper(exponent);
			g.IL.Emit(OpCodes.Newobj, decimalExtConstructor);
		}
开发者ID:amithasan,项目名称:Framework-Class-Library-Extension,代码行数:30,代码来源:DecimalLiteral.cs

示例5: EmitGet

		protected internal override void EmitGet(CodeGen g)  
        {
		    OperandExtensions.SetLeakedState(this, false); 
			int[] bits = decimal.GetBits(_value);
			byte exponent = unchecked((byte)((bits[3] >> 16) & 0x1f));
			bool sign = bits[3] < 0;

		    Type intType = g.TypeMapper.MapType(typeof(int));
		    if (exponent == 0 && bits[2] == 0)
			{
				if (bits[1] == 0 && (bits[0] > 0 || (bits[0] == 0 && !sign)))	// fits in int32 - use the basic int constructor
				{
					g.EmitI4Helper(sign ? -bits[0] : bits[0]);
					g.IL.Emit(OpCodes.Newobj, (ConstructorInfo)g.TypeMapper.MapType(typeof(decimal)).GetConstructor(new Type[] { intType }));
					return;
				}
				if (bits[1] > 0)	// fits in int64
				{
					long l = unchecked((long)(((ulong)(uint)bits[1] << 32) | (ulong)(uint)bits[0]));
					g.IL.Emit(OpCodes.Ldc_I8, sign ? -l : l);
					g.IL.Emit(OpCodes.Newobj, (ConstructorInfo)g.TypeMapper.MapType(typeof(decimal)).GetConstructor(new Type[] { g.TypeMapper.MapType(typeof(long)) }));
					return;
				}
			}

			g.EmitI4Helper(bits[0]);
			g.EmitI4Helper(bits[1]);
			g.EmitI4Helper(bits[2]);
			g.EmitI4Helper(sign ? 1 : 0);
			g.EmitI4Helper(exponent);
			g.IL.Emit(OpCodes.Newobj, (ConstructorInfo)g.TypeMapper.MapType(typeof(decimal)).GetConstructor(
                new Type[] { intType, intType, intType, g.TypeMapper.MapType(typeof(bool)), g.TypeMapper.MapType(typeof(byte)) }));
		}
开发者ID:AqlaSolutions,项目名称:runsharp,代码行数:33,代码来源:DecimalLiteral.cs

示例6: EmitGet

		internal override void EmitGet(CodeGen g)
		{
			g.EmitI4Helper(value);
		}
开发者ID:amithasan,项目名称:Framework-Class-Library-Extension,代码行数:4,代码来源:IntLiteral.cs

示例7: EmitGet

		protected internal override void EmitGet(CodeGen g)  
        {
		    OperandExtensions.SetLeakedState(this, false); 
			g.EmitI4Helper(Value);
		}
开发者ID:AqlaSolutions,项目名称:runsharp,代码行数:5,代码来源:IntLiteral.cs


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