本文整理汇总了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);
}
}
示例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));
}
示例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);
}
}
示例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);
}
示例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)) }));
}
示例6: EmitGet
internal override void EmitGet(CodeGen g)
{
g.EmitI4Helper(value);
}
示例7: EmitGet
protected internal override void EmitGet(CodeGen g)
{
OperandExtensions.SetLeakedState(this, false);
g.EmitI4Helper(Value);
}