Recurity.Swf.SwfEncodedU32.SwfDecodeU32 C# (CSharp) Method

SwfDecodeU32() private static method

Decodes the byte representation of an ulong value to the ulong value itself
private static SwfDecodeU32 ( byte data ) : ulong
data byte byte representation
return ulong
        private static ulong SwfDecodeU32(byte[] data)
        {
            ulong result = 0;
            for (int i = 0; i < data.Length - 1; i++)                           // for each byte of the encoded value
                result = result + (((ulong)data[i] & 127) << (i * 7));          // seven bit are added to the result
            result += (ulong)data[data.Length - 1] << ((data.Length - 1) * 7);  // except the last byte which contains eight bits
            return result;                                                      // of the result
        }