System.IO.Compression.HuffmanTree.CreateTable C# (CSharp) Méthode

CreateTable() private méthode

private CreateTable ( ) : void
Résultat void
        private void CreateTable() {
            uint[] numArray = this.CalculateHuffmanCode();
            this.table = new short[((int)1) << this.tableBits];
            this.left = new short[2 * this.codeLengthArray.Length];
            this.right = new short[2 * this.codeLengthArray.Length];
            short length = (short)this.codeLengthArray.Length;
            for (int i = 0; i < this.codeLengthArray.Length; i++) {
                int num3 = this.codeLengthArray[i];
                if (num3 > 0) {
                    int index = (int)numArray[i];
                    if (num3 <= this.tableBits) {
                        int num5 = ((int)1) << num3;
                        if (index >= num5) {
                            throw new InvalidDataException("Failed to construct a huffman tree using the length array. The stream might be corrupted.");
                        }
                        int num6 = ((int)1) << (this.tableBits - num3);
                        for (int j = 0; j < num6; j++) {
                            this.table[index] = (short)i;
                            index += num5;
                        }
                    }
                    else {
                        int num8 = num3 - this.tableBits;
                        int num9 = ((int)1) << this.tableBits;
                        int num10 = index & ((((int)1) << this.tableBits) - 1);
                        short[] table = this.table;
                        do {
                            short num11 = table[num10];
                            if (num11 == 0) {
                                table[num10] = (short)(-length);
                                num11 = (short)(-length);
                                length++;
                            }
                            if ((index & num9) == 0) {
                                table = this.left;
                            }
                            else {
                                table = this.right;
                            }
                            num10 = -num11;
                            num9 <<= 1;
                            num8--;
                        }
                        while (num8 != 0);
                        table[num10] = (short)i;
                    }
                }
            }
        }