예제 #1
0
 public ComputeType(ComputeScalarType scalarType, Int32 rank)
     : this()
 {
     Debug.Assert(rank >= 0);
     Debug.Assert(scalarType != null);
     ScalarType = scalarType;
     Rank       = rank;
 }
예제 #2
0
        public static ComputeType?FromType(TYPE type)
        {
            ARRAY_TYPE        arrayType;
            ComputeScalarType scalarType;

            if (type.Is(out arrayType) && arrayType.isMath)
            {
                if (arrayType.isMath && ComputeScalarType.TryGet(arrayType.base_type, out scalarType))
                {
                    return(new ComputeType(scalarType, arrayType.dimensions.Length));
                }
                //} else {
                //    if (ComputeScalarType.TryGet(type, out scalarType)) {
                //        return new ComputeType(scalarType, 0);
                //    }
            }
            return(null);
        }
예제 #3
0
        public static Boolean TryGet(TYPE type, out ComputeScalarType computeType)
        {
            REAL_TYPE realType;

            if (type.Is(out realType))
            {
                if (realType.width == 32)
                {
                    computeType = Single;
                    return(true);
                }
            }

            /*CARDINAL_TYPE cardType;
             * if (type.Is(out cardType)) {
             *  if (cardType.width == 32) {
             *      computeType = Single;
             *      return true;
             *  }
             * }*/
            computeType = null;
            return(false);
        }