public static Instruction Create(Type type) { Debug.Assert(!type.GetTypeInfo().IsEnum); switch (System.Dynamic.Utils.TypeExtensions.GetTypeCode(TypeUtils.GetNonNullableType(type))) { case TypeCode.Int16: return s_int16 ?? (s_int16 = new SubInt16()); case TypeCode.Int32: return s_int32 ?? (s_int32 = new SubInt32()); case TypeCode.Int64: return s_int64 ?? (s_int64 = new SubInt64()); case TypeCode.UInt16: return s_UInt16 ?? (s_UInt16 = new SubUInt16()); case TypeCode.UInt32: return s_UInt32 ?? (s_UInt32 = new SubUInt32()); case TypeCode.UInt64: return s_UInt64 ?? (s_UInt64 = new SubUInt64()); case TypeCode.Single: return s_single ?? (s_single = new SubSingle()); case TypeCode.Double: return s_double ?? (s_double = new SubDouble()); default: throw Error.ExpressionNotSupportedForType("Sub", type); } }
public static Instruction Create(Type type) { Debug.Assert(type.IsArithmetic()); switch (type.GetNonNullableType().GetTypeCode()) { case TypeCode.Int16: return s_int16 ?? (s_int16 = new SubInt16()); case TypeCode.Int32: return s_int32 ?? (s_int32 = new SubInt32()); case TypeCode.Int64: return s_int64 ?? (s_int64 = new SubInt64()); case TypeCode.UInt16: return s_UInt16 ?? (s_UInt16 = new SubUInt16()); case TypeCode.UInt32: return s_UInt32 ?? (s_UInt32 = new SubUInt32()); case TypeCode.UInt64: return s_UInt64 ?? (s_UInt64 = new SubUInt64()); case TypeCode.Single: return s_single ?? (s_single = new SubSingle()); case TypeCode.Double: return s_double ?? (s_double = new SubDouble()); default: throw ContractUtils.Unreachable; } }
public static Instruction Create(Type type) { Debug.Assert(!type.IsEnum()); switch (type.GetTypeCode()) { case TypeCode.Int16: return _Int16 ?? (_Int16 = new SubInt16()); case TypeCode.Int32: return _Int32 ?? (_Int32 = new SubInt32()); case TypeCode.Int64: return _Int64 ?? (_Int64 = new SubInt64()); case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new SubUInt16()); case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new SubUInt32()); case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new SubUInt64()); case TypeCode.Single: return _Single ?? (_Single = new SubSingle()); case TypeCode.Double: return _Double ?? (_Double = new SubDouble()); default: throw Assert.Unreachable; } }