예제 #1
0
        public static Instruction Create(Type type)
        {
            Debug.Assert(!type.IsEnum);
            switch (type.GetNonNullableType().GetTypeCode())
            {
            case TypeCode.Int16: return(s_Int16 ?? (s_Int16 = new DivInt16()));

            case TypeCode.Int32: return(s_Int32 ?? (s_Int32 = new DivInt32()));

            case TypeCode.Int64: return(s_Int64 ?? (s_Int64 = new DivInt64()));

            case TypeCode.UInt16: return(s_UInt16 ?? (s_UInt16 = new DivUInt16()));

            case TypeCode.UInt32: return(s_UInt32 ?? (s_UInt32 = new DivUInt32()));

            case TypeCode.UInt64: return(s_UInt64 ?? (s_UInt64 = new DivUInt64()));

            case TypeCode.Single: return(s_Single ?? (s_Single = new DivSingle()));

            case TypeCode.Double: return(s_Double ?? (s_Double = new DivDouble()));

            default:
                throw ContractUtils.Unreachable;
            }
        }
예제 #2
0
        public static Instruction Create(Type type)
        {
            Debug.Assert(!type.GetTypeInfo().IsEnum);
            switch (TypeUtils.GetNonNullableType(type).GetTypeCode())
            {
            case TypeCode.Int16: return(s_int16 ?? (s_int16 = new DivInt16()));

            case TypeCode.Int32: return(s_int32 ?? (s_int32 = new DivInt32()));

            case TypeCode.Int64: return(s_int64 ?? (s_int64 = new DivInt64()));

            case TypeCode.UInt16: return(s_UInt16 ?? (s_UInt16 = new DivUInt16()));

            case TypeCode.UInt32: return(s_UInt32 ?? (s_UInt32 = new DivUInt32()));

            case TypeCode.UInt64: return(s_UInt64 ?? (s_UInt64 = new DivUInt64()));

            case TypeCode.Single: return(s_single ?? (s_single = new DivSingle()));

            case TypeCode.Double: return(s_double ?? (s_double = new DivDouble()));

            default:
                throw Error.ExpressionNotSupportedForType("Div", type);
            }
        }
예제 #3
0
        public static Instruction Create(Type type)
        {
            Debug.Assert(!type.IsEnum);
            switch (Type.GetTypeCode(type))
            {
            case TypeCode.Int16: return(_Int16 ?? (_Int16 = new DivInt16()));

            case TypeCode.Int32: return(_Int32 ?? (_Int32 = new DivInt32()));

            case TypeCode.Int64: return(_Int64 ?? (_Int64 = new DivInt64()));

            case TypeCode.UInt16: return(_UInt16 ?? (_UInt16 = new DivUInt16()));

            case TypeCode.UInt32: return(_UInt32 ?? (_UInt32 = new DivUInt32()));

            case TypeCode.UInt64: return(_UInt64 ?? (_UInt64 = new DivUInt64()));

            case TypeCode.Single: return(_Single ?? (_Single = new DivSingle()));

            case TypeCode.Double: return(_Double ?? (_Double = new DivDouble()));

            default:
                throw Assert.Unreachable;
            }
        }
예제 #4
0
 public static Instruction Create(Type type)
 {
     Debug.Assert(!type.IsEnum);
     return(type.GetNonNullableType().GetTypeCode() switch
     {
         TypeCode.Int16 => s_Int16 ?? (s_Int16 = new DivInt16()),
         TypeCode.Int32 => s_Int32 ?? (s_Int32 = new DivInt32()),
         TypeCode.Int64 => s_Int64 ?? (s_Int64 = new DivInt64()),
         TypeCode.UInt16 => s_UInt16 ?? (s_UInt16 = new DivUInt16()),
         TypeCode.UInt32 => s_UInt32 ?? (s_UInt32 = new DivUInt32()),
         TypeCode.UInt64 => s_UInt64 ?? (s_UInt64 = new DivUInt64()),
         TypeCode.Single => s_Single ?? (s_Single = new DivSingle()),
         TypeCode.Double => s_Double ?? (s_Double = new DivDouble()),
         _ => throw ContractUtils.Unreachable,
     });
예제 #5
0
        public static Instruction Create(Type type)
        {
            Debug.Assert(!type.IsEnum());
            switch (type.GetTypeCode()) {
                case TypeCode.Int16: return _Int16 ?? (_Int16 = new DivInt16());
                case TypeCode.Int32: return _Int32 ?? (_Int32 = new DivInt32());
                case TypeCode.Int64: return _Int64 ?? (_Int64 = new DivInt64());
                case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new DivUInt16());
                case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new DivUInt32());
                case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new DivUInt64());
                case TypeCode.Single: return _Single ?? (_Single = new DivSingle());
                case TypeCode.Double: return _Double ?? (_Double = new DivDouble());

                default:
                    throw Assert.Unreachable;
            }
        }
예제 #6
0
        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 DivInt16());
                case TypeCode.Int32: return s_int32 ?? (s_int32 = new DivInt32());
                case TypeCode.Int64: return s_int64 ?? (s_int64 = new DivInt64());
                case TypeCode.UInt16: return s_UInt16 ?? (s_UInt16 = new DivUInt16());
                case TypeCode.UInt32: return s_UInt32 ?? (s_UInt32 = new DivUInt32());
                case TypeCode.UInt64: return s_UInt64 ?? (s_UInt64 = new DivUInt64());
                case TypeCode.Single: return s_single ?? (s_single = new DivSingle());
                case TypeCode.Double: return s_double ?? (s_double = new DivDouble());

                default:
                    throw Error.ExpressionNotSupportedForType("Div", type);
            }
        }