OpCode GetStoreEntityOpCode(IType tag)
{
if (tag.IsValueType || tag is IGenericParameter)
{
if (tag.IsEnum)
{
tag = TypeSystemServices.Map(GetEnumUnderlyingType(tag));
}
if (TypeSystemServices.IntType == tag ||
TypeSystemServices.UIntType == tag)
{
return OpCodes.Stelem_I4;
}
else if (IsLong(tag) ||
TypeSystemServices.ULongType == tag)
{
return OpCodes.Stelem_I8;
}
else if (TypeSystemServices.ShortType == tag ||
TypeSystemServices.CharType == tag)
{
return OpCodes.Stelem_I2;
}
else if (TypeSystemServices.ByteType == tag ||
TypeSystemServices.SByteType == tag)
{
return OpCodes.Stelem_I1;
}
else if (TypeSystemServices.SingleType == tag)
{
return OpCodes.Stelem_R4;
}
else if (TypeSystemServices.DoubleType == tag)
{
return OpCodes.Stelem_R8;
}
return OpCodes.Stobj;
}
return OpCodes.Stelem_Ref;
}