public void EmitAdd(Type type, bool @checked) { if (@checked) { Emit(AddOvfInstruction.Create(type)); } else { Emit(AddInstruction.Create(type)); } }
public static Instruction Create(Type type) { Debug.Assert(type.IsArithmetic()); switch (Type.GetTypeCode(type.GetNonNullable())) { case TypeCode.Int16: return(_int16 ??= new AddOvfInt16()); case TypeCode.Int32: return(_int32 ??= new AddOvfInt32()); case TypeCode.Int64: return(_int64 ??= new AddOvfInt64()); case TypeCode.UInt16: return(_uInt16 ??= new AddOvfUInt16()); case TypeCode.UInt32: return(_uInt32 ??= new AddOvfUInt32()); case TypeCode.UInt64: return(_uInt64 ??= new AddOvfUInt64()); default: return(AddInstruction.Create(type)); } }
public static Instruction Create(Type type) { Debug.Assert(TypeUtils.IsArithmetic(type)); switch (System.Dynamic.Utils.TypeExtensions.GetTypeCode(TypeUtils.GetNonNullableType(type))) { case TypeCode.Int16: return(s_int16 ?? (s_int16 = new AddOvfInt16())); case TypeCode.Int32: return(s_int32 ?? (s_int32 = new AddOvfInt32())); case TypeCode.Int64: return(s_int64 ?? (s_int64 = new AddOvfInt64())); case TypeCode.UInt16: return(s_UInt16 ?? (s_UInt16 = new AddOvfUInt16())); case TypeCode.UInt32: return(s_UInt32 ?? (s_UInt32 = new AddOvfUInt32())); case TypeCode.UInt64: return(s_UInt64 ?? (s_UInt64 = new AddOvfUInt64())); default: return(AddInstruction.Create(type)); } }
public void EmitAdd(Type type, bool @checked) { Emit(@checked ? AddOvfInstruction.Create(type) : AddInstruction.Create(type)); }