コード例 #1
0
ファイル: System.String.cs プロジェクト: pandyer/dnaunity
        public static tAsyncCall *InternalIndexOf(tJITCallNative *pCallNative, byte *pThis, byte *pParams, byte *pReturnValue)
        {
            char   value;
            uint   forwards;
            int    startIndex, count, i;
            string s;

            s          = ToMonoString((tSystemString *)pThis);
            value      = (*((char *)(pParams + 0)));
            startIndex = (*((int *)(pParams + Sys.S_INT32)));
            count      = (*((int *)(pParams + Sys.S_INT32 + Sys.S_INT32)));
            forwards   = (*((uint *)(pParams + Sys.S_INT32 + Sys.S_INT32 + Sys.S_INT32)));

            if (forwards != 0)
            {
                i = s.IndexOf(value, startIndex, count);
            }
            else
            {
                i = s.LastIndexOf(value, startIndex, count);
            }

            Sys.INTERNALCALL_RESULT_I32(pReturnValue, i);

            return(null);
        }
コード例 #2
0
ファイル: System.String.cs プロジェクト: pandyer/dnaunity
        public static tAsyncCall *InternalIndexOfAny(tJITCallNative *pCallNative, byte *pThis, byte *pParams, byte *pReturnValue)
        {
            /*HEAP_PTR*/ byte *valueArray;
            int    startIndex, count;
            uint   forwards;
            string s;

            s          = ToMonoString((tSystemString *)pThis);
            valueArray = (*((/*HEAP_PTR*/ byte **)(pParams + 0)));
            startIndex = (*((int *)(pParams + Sys.S_PTR)));
            count      = (*((int *)(pParams + Sys.S_PTR + Sys.S_INT32)));
            forwards   = (*((uint *)(pParams + Sys.S_PTR + Sys.S_INT32 + Sys.S_INT32)));

            byte *valueChars    = System_Array.GetElements(valueArray);
            uint  numValueChars = System_Array.GetLength(valueArray);

            int lastIndex;
            int inc;
            int i, j;

            if (forwards != 0)
            {
                lastIndex = startIndex + count;
                inc       = 1;
                i         = startIndex;
            }
            else
            {
                lastIndex = startIndex - 1;
                inc       = -1;
                i         = startIndex + count - 1;
            }
            for (; i != lastIndex; i += inc)
            {
                char thisChar = s[i];
                for (j = (int)numValueChars - 1; j >= 0; j--)
                {
                    if (thisChar == ((ushort *)valueChars)[j])
                    {
                        Sys.INTERNALCALL_RESULT_I32(pReturnValue, i);
                        return(null);
                    }
                }
            }
            Sys.INTERNALCALL_RESULT_I32(pReturnValue, -1);
            return(null);
        }
コード例 #3
0
ファイル: System.String.cs プロジェクト: bmjoy/dnaunity
        public static tAsyncCall *InternalIndexOf(tJITCallNative *pCallNative, byte *pThis_, byte *pParams, byte *pReturnValue)
        {
            tSystemString *pThis      = (tSystemString *)pThis_;
            ushort         value      = (*((ushort *)(pParams + 0)));
            int            startIndex = (*((int *)(pParams + Sys.S_INT32)));
            int            count      = (*((int *)(pParams + Sys.S_INT32 + Sys.S_INT32)));
            uint           forwards   = (*((uint *)(pParams + Sys.S_INT32 + Sys.S_INT32 + Sys.S_INT32)));
            char *         pChars     = tSystemString.GetChars(pThis);

            int lastIndex;
            int inc;
            int i;

            if (forwards != 0)
            {
                lastIndex = startIndex + count;
                inc       = 1;
                i         = startIndex;
            }
            else
            {
                lastIndex = startIndex - 1;
                inc       = -1;
                i         = startIndex + count - 1;
            }
            for (; i != lastIndex; i += inc)
            {
                if (pChars[i] == value)
                {
                    Sys.INTERNALCALL_RESULT_I32(pReturnValue, i);
                    return(null);
                }
            }
            Sys.INTERNALCALL_RESULT_I32(pReturnValue, -1);
            return(null);
        }