ReverseBits() private static method

private static ReverseBits ( byte data ) : byte
data byte
return byte
Beispiel #1
0
        private void GenerateLookupTable()
        {
            this.crc32Table = new uint[256];
            byte b = 0;

            while (true)
            {
                uint num = b;
                for (byte b2 = 8; b2 > 0; b2 = (byte)(b2 - 1))
                {
                    num = (((num & 1) != 1) ? (num >> 1) : (num >> 1 ^ this.dwPolynomial));
                }
                if (this.reverseBits)
                {
                    this.crc32Table[CRC32.ReverseBits(b)] = CRC32.ReverseBits(num);
                }
                else
                {
                    this.crc32Table[b] = num;
                }
                b = (byte)(b + 1);
                if (b == 0)
                {
                    break;
                }
            }
        }
Beispiel #2
0
        // Token: 0x060004E0 RID: 1248 RVA: 0x00028F98 File Offset: 0x00027198
        private void GenerateLookupTable()
        {
            this.crc32Table = new uint[256];
            byte i = 0;

            do
            {
                uint dwCrc = (uint)i;
                for (byte j = 8; j > 0; j -= 1)
                {
                    if ((dwCrc & 1u) == 1u)
                    {
                        dwCrc = (dwCrc >> 1 ^ this.dwPolynomial);
                    }
                    else
                    {
                        dwCrc >>= 1;
                    }
                }
                if (this.reverseBits)
                {
                    this.crc32Table[(int)CRC32.ReverseBits(i)] = CRC32.ReverseBits(dwCrc);
                }
                else
                {
                    this.crc32Table[(int)i] = dwCrc;
                }
                i += 1;
            }while (i != 0);
        }
 private void GenerateLookupTable()
 {
     this.crc32Table = new uint[256];
     byte b = 0;
     do
     {
         uint num = (uint)b;
         for (byte b2 = 8; b2 > 0; b2 -= 1)
         {
             if ((num & 1u) == 1u)
             {
                 num = (num >> 1 ^ this.dwPolynomial);
             }
             else
             {
                 num >>= 1;
             }
         }
         if (this.reverseBits)
         {
             this.crc32Table[(int)CRC32.ReverseBits(b)] = CRC32.ReverseBits(num);
         }
         else
         {
             this.crc32Table[(int)b] = num;
         }
         b += 1;
     }
     while (b != 0);
 }
Beispiel #4
0
        private void GenerateLookupTable()
        {
            this.crc32Table = new uint[256];
            byte data1 = 0;

            do
            {
                uint data2 = (uint)data1;
                for (byte index = 8; (int)index > 0; --index)
                {
                    if (((int)data2 & 1) == 1)
                    {
                        data2 = data2 >> 1 ^ this.dwPolynomial;
                    }
                    else
                    {
                        data2 >>= 1;
                    }
                }
                if (this.reverseBits)
                {
                    this.crc32Table[(int)CRC32.ReverseBits(data1)] = CRC32.ReverseBits(data2);
                }
                else
                {
                    this.crc32Table[(int)data1] = data2;
                }
                ++data1;
            }while ((int)data1 != 0);
        }