Esempio n. 1
0
        public static Instruction Create(Type type)
        {
            Debug.Assert(!type.IsEnum);
            switch (type.GetNonNullable().GetTypeCode())
            {
            case TypeCode.Int16: return(_int16 ?? (_int16 = new NegateCheckedInt16()));

            case TypeCode.Int32: return(_int32 ?? (_int32 = new NegateCheckedInt32()));

            case TypeCode.Int64: return(_int64 ?? (_int64 = new NegateCheckedInt64()));

            default:
                return(NegateInstruction.Create(type));
            }
        }
Esempio n. 2
0
        public static Instruction Create(Type type)
        {
            Debug.Assert(!type.GetTypeInfo().IsEnum);
            switch (type.GetNonNullableType().GetTypeCode())
            {
            case TypeCode.Int16: return(s_int16 ?? (s_int16 = new NegateCheckedInt16()));

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

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

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

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

            default:
                throw Error.ExpressionNotSupportedForType("NegateChecked", type);
            }
        }
Esempio n. 3
0
        public static Instruction Create(Type type)
        {
            Debug.Assert(!type.IsEnum);
            switch (type.GetNonNullableType().GetTypeCode())
            {
            case TypeCode.Int16: return(s_Int16 ?? (s_Int16 = new NegateCheckedInt16()));

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

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

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

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

            default:
                throw ContractUtils.Unreachable;
            }
        }
Esempio n. 4
0
 public static Instruction Create(Type type)
 {
     Debug.Assert(!type.GetTypeInfo().IsEnum);
     switch (type.GetNonNullableType().GetTypeCode())
     {
         case TypeCode.Int16: return s_int16 ?? (s_int16 = new NegateCheckedInt16());
         case TypeCode.Int32: return s_int32 ?? (s_int32 = new NegateCheckedInt32());
         case TypeCode.Int64: return s_int64 ?? (s_int64 = new NegateCheckedInt64());
         case TypeCode.Single: return s_single ?? (s_single = new NegateCheckedSingle());
         case TypeCode.Double: return s_double ?? (s_double = new NegateCheckedDouble());
         default:
             throw Error.ExpressionNotSupportedForType("NegateChecked", type);
     }
 }