GetPrimaryCompositeHelperIndex() static private method

static private GetPrimaryCompositeHelperIndex ( int cp ) : int
cp int
return int
 private static bool CanBePrimaryComposite(int i)
 {
     if (i >= 13312 && i <= 40891)
     {
         return(Normalization.GetPrimaryCompositeHelperIndex(i) != 0);
     }
     return((Normalization.PropValue(i) & 128u) != 0u);
 }
        private unsafe static int GetPrimaryCompositeCharIndex(object chars, int start)
        {
            string        text          = chars as string;
            StringBuilder stringBuilder = chars as StringBuilder;
            char          c             = (text == null) ? stringBuilder[start] : text[start];
            int           num           = (stringBuilder == null) ? text.Length : stringBuilder.Length;
            int           num2          = Normalization.GetPrimaryCompositeHelperIndex((int)c);

            if (num2 == 0)
            {
                return(0);
            }
            while (Normalization.mappedChars[num2] == (int)c)
            {
                int num3 = 0;
                int num4 = 1;
                int num5 = 1;
                for (;;)
                {
                    int num6 = num3;
                    if (Normalization.mappedChars[num2 + num4] == 0)
                    {
                        return(num2);
                    }
                    if (start + num4 >= num)
                    {
                        return(0);
                    }
                    bool flag = false;
                    char c2;
                    do
                    {
                        c2   = ((text == null) ? stringBuilder[start + num5] : text[start + num5]);
                        num3 = (int)Normalization.GetCombiningClass((int)c2);
                        if (Normalization.mappedChars[num2 + num4] == (int)c2)
                        {
                            goto Block_7;
                        }
                        if (num3 < num6)
                        {
                            break;
                        }
                    }while (++num5 + start < num && num3 != 0);
IL_105:
                    if (!flag)
                    {
                        if (num6 >= num3)
                        {
                            break;
                        }
                        num5--;
                        if (Normalization.mappedChars[num2 + num4] != (int)c2)
                        {
                            break;
                        }
                    }
                    num4++;
                    num5++;
                    continue;
Block_7:
                    flag = true;
                    goto IL_105;
                }
                while (Normalization.mappedChars[num4] != 0)
                {
                    num4++;
                }
                num2 += num4 + 1;
            }
            return(0);
        }