// Token: 0x06000778 RID: 1912 RVA: 0x00033010 File Offset: 0x00031210
 internal static int DistanceCode(int dist)
 {
     if (dist >= 256)
     {
         return((int)Class_200._dist_code[256 + Class_206.gmethod_1313(dist, 7)]);
     }
     return((int)Class_200._dist_code[dist]);
 }
Exemple #2
0
        // Token: 0x0600074C RID: 1868 RVA: 0x00031DDC File Offset: 0x0002FFDC
        private int huft_build(int[] b, int bindex, int n, int s, int[] d, int[] e, int[] t, int[] m, int[] hp, int[] hn, int[] v)
        {
            int num  = 0;
            int num2 = n;

            do
            {
                this.c[b[bindex + num]]++;
                num++;
                num2--;
            }while (num2 != 0);
            if (this.c[0] == n)
            {
                t[0] = -1;
                m[0] = 0;
                return(0);
            }
            int num3 = m[0];
            int i    = 1;

            while (i <= 15 && this.c[i] == 0)
            {
                i++;
            }
            int j = i;

            if (num3 < i)
            {
                num3 = i;
            }
            num2 = 15;
            while (num2 != 0 && this.c[num2] == 0)
            {
                num2--;
            }
            int num4 = num2;

            if (num3 > num2)
            {
                num3 = num2;
            }
            m[0] = num3;
            int num5 = 1 << i;

            while (i < num2)
            {
                if ((num5 -= this.c[i]) < 0)
                {
                    return(-3);
                }
                i++;
                num5 <<= 1;
            }
            if ((num5 -= this.c[num2]) < 0)
            {
                return(-3);
            }
            this.c[num2] += num5;
            i             = (this.x[1] = 0);
            num           = 1;
            int num6 = 2;

            while (--num2 != 0)
            {
                i = (this.x[num6] = i + this.c[num]);
                num6++;
                num++;
            }
            num2 = 0;
            num  = 0;
            do
            {
                if ((i = b[bindex + num]) != 0)
                {
                    v[this.x[i]++] = num2;
                }
                num++;
            }while (++num2 < n);
            n    = this.x[num4];
            num2 = (this.x[0] = 0);
            num  = 0;
            int num7 = -1;
            int num8 = -num3;

            this.u[0] = 0;
            int num9  = 0;
            int num10 = 0;

            while (j <= num4)
            {
                int num11 = this.c[j];
                while (num11-- != 0)
                {
                    int num12;
                    while (j > num8 + num3)
                    {
                        num7++;
                        num8 += num3;
                        num10 = num4 - num8;
                        num10 = ((num10 > num3) ? num3 : num10);
                        if ((num12 = 1 << ((i = j - num8) & 31)) > num11 + 1)
                        {
                            num12 -= num11 + 1;
                            num6   = j;
                            if (i < num10)
                            {
                                while (++i < num10 && (num12 <<= 1) > this.c[++num6])
                                {
                                    num12 -= this.c[num6];
                                }
                            }
                        }
                        num10 = 1 << i;
                        if (hn[0] + num10 > 1440)
                        {
                            return(-3);
                        }
                        num9   = (this.u[num7] = hn[0]);
                        hn[0] += num10;
                        if (num7 != 0)
                        {
                            this.x[num7] = num2;
                            this.r[0]    = (int)((sbyte)i);
                            this.r[1]    = (int)((sbyte)num3);
                            i            = Class_206.gmethod_1313(num2, num8 - num3);
                            this.r[2]    = num9 - this.u[num7 - 1] - i;
                            Array.Copy(this.r, 0, hp, (this.u[num7 - 1] + i) * 3, 3);
                        }
                        else
                        {
                            t[0] = num9;
                        }
                    }
                    this.r[1] = (int)((sbyte)(j - num8));
                    if (num >= n)
                    {
                        this.r[0] = 192;
                    }
                    else if (v[num] < s)
                    {
                        this.r[0] = (int)((v[num] < 256) ? 0 : 96);
                        this.r[2] = v[num++];
                    }
                    else
                    {
                        this.r[0] = (int)((sbyte)(e[v[num] - s] + 16 + 64));
                        this.r[2] = d[v[num++] - s];
                    }
                    num12 = 1 << j - num8;
                    for (i = Class_206.gmethod_1313(num2, num8); i < num10; i += num12)
                    {
                        Array.Copy(this.r, 0, hp, (num9 + i) * 3, 3);
                    }
                    i = 1 << j - 1;
                    while ((num2 & i) != 0)
                    {
                        num2 ^= i;
                        i     = Class_206.gmethod_1313(i, 1);
                    }
                    num2 ^= i;
                    int num13 = (1 << num8) - 1;
                    while ((num2 & num13) != this.x[num7])
                    {
                        num7--;
                        num8 -= num3;
                        num13 = (1 << num8) - 1;
                    }
                }
                j++;
            }
            if (num5 == 0 || num4 == 1)
            {
                return(0);
            }
            return(-5);
        }