示例#1
0
        public static Instruction Create(Type type)
        {
            Debug.Assert(!type.IsEnum());
            switch (type.GetTypeCode())
            {
            case TypeCode.Int16: return(_Int16 ?? (_Int16 = new NegateInt16()));

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

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

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

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

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

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

            default:
                throw Assert.Unreachable;
            }
        }
        public static Instruction Create(Type type) {
            Debug.Assert(!type.IsEnum());
            switch (type.GetTypeCode()) {
                case TypeCode.Int16: return _Int16 ?? (_Int16 = new NegateInt16());
                case TypeCode.Int32: return _Int32 ?? (_Int32 = new NegateInt32());
                case TypeCode.Int64: return _Int64 ?? (_Int64 = new NegateInt64());
                case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new NegateUInt16());
                case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new NegateUInt32());
                case TypeCode.Single: return _Single ?? (_Single = new NegateSingle());
                case TypeCode.Double: return _Double ?? (_Double = new NegateDouble());

                default:
                    throw Assert.Unreachable;
            }
        }