Beispiel #1
0
        int __Size(DDN.ElementType type)
        {
            switch (type)
            {
            case DDN.ElementType.End:                       return(-1);

            case DDN.ElementType.Void:                      return(0);

            case DDN.ElementType.Boolean:           return(1);

            case DDN.ElementType.Char:                      return(2);

            case DDN.ElementType.I1:
            case DDN.ElementType.U1:                        return(1);

            case DDN.ElementType.I2:
            case DDN.ElementType.U2:                        return(2);

            case DDN.ElementType.I4:
            case DDN.ElementType.U4:                        return(4);

            case DDN.ElementType.I8:
            case DDN.ElementType.U8:                        return(8);

            case DDN.ElementType.R4:                        return(4);

            case DDN.ElementType.R8:                        return(8);

            case DDN.ElementType.String:
            case DDN.ElementType.Ptr:
            case DDN.ElementType.ByRef:                     return(AppDomain.Runtime.PointerSize);

            case DDN.ElementType.ValueType:         return(-1);

            case DDN.ElementType.Class:
            case DDN.ElementType.Var:
            case DDN.ElementType.Array:
            case DDN.ElementType.GenericInst:
            case DDN.ElementType.TypedByRef:        return(AppDomain.Runtime.PointerSize);

            case DDN.ElementType.ValueArray:        return(-1);

            case DDN.ElementType.I:
            case DDN.ElementType.U:                         return(AppDomain.Runtime.PointerSize);

            case DDN.ElementType.R:                         return(-1);

            case DDN.ElementType.FnPtr:
            case DDN.ElementType.Object:
            case DDN.ElementType.SZArray:
            case DDN.ElementType.MVar:                      return(AppDomain.Runtime.PointerSize);

            case DDN.ElementType.CModReqd:
            case DDN.ElementType.CModOpt:
            case DDN.ElementType.Internal:          return(0);

            default:
                return(0);
            }
        }
Beispiel #2
0
        bool __IsObjRef(DDN.ElementType type)
        {
            switch (type)
            {
            case DDN.ElementType.String:
            case DDN.ElementType.Class:
            case DDN.ElementType.Array:
            case DDN.ElementType.Object:
            case DDN.ElementType.SZArray:
                return(true);

            default:
                return(false);
            }
        }
Beispiel #3
0
 bool __IsGenericVariable(DDN.ElementType type) => type == DDN.ElementType.Var || type == DDN.ElementType.MVar;
Beispiel #4
0
 bool __IsPrimitiveType(DDN.ElementType type) => (DDN.ElementType.Void <= type && type <= DDN.ElementType.R8) || type == DDN.ElementType.I || type == DDN.ElementType.U;
Beispiel #5
0
 bool __IsFloat(DDN.ElementType type) => type == DDN.ElementType.R4 || type == DDN.ElementType.R8;
Beispiel #6
0
 protected TSpec(DMD.ElementType etype) => this.etype = etype;