System.IO.Compression.DecodeHelper.BitReverse C# (CSharp) Méthode

BitReverse() public static méthode

public static BitReverse ( uint code, int length ) : uint
code uint
length int
Résultat uint
        public static uint BitReverse(uint code, int length) {
            uint num = 0;
            do {
                num |= code & 1;
                num <<= 1;
                code >>= 1;
            }
            while (--length > 0);
            return (num >> 1);
        }

Usage Example

Exemple #1
0
        private uint[] CalculateHuffmanCode()
        {
            uint[] numArray        = new uint[0x11];
            byte[] codeLengthArray = this.codeLengthArray;
            for (int i = 0; i < codeLengthArray.Length; i++)
            {
                int index = codeLengthArray[i];
                numArray[index]++;
            }
            numArray[0] = 0;
            uint[] numArray2 = new uint[0x11];
            uint   num2      = 0;

            for (int j = 1; j <= 0x10; j++)
            {
                numArray2[j] = (num2 + numArray[j - 1]) << 1;
            }
            uint[] numArray3 = new uint[0x120];
            for (int k = 0; k < this.codeLengthArray.Length; k++)
            {
                int length = this.codeLengthArray[k];
                if (length > 0)
                {
                    numArray3[k] = DecodeHelper.BitReverse(numArray2[length], length);
                    numArray2[length]++;
                }
            }
            return(numArray3);
        }
All Usage Examples Of System.IO.Compression.DecodeHelper::BitReverse