Recurity.Swf.SwfEncodedU32.SwfEncodeU32 C# (CSharp) 메소드

SwfEncodeU32() 개인적인 정적인 메소드

Encodes a value of type ulong to a byte array.
private static SwfEncodeU32 ( ulong value ) : byte[]
value ulong Value to convert
리턴 byte[]
        private static byte[] SwfEncodeU32(ulong value)
        {
            byte[] result = new byte[SwfEncodedSizeOf(value)];                              // allocate a byte array to save the encoded values
            for (int i = 0; i < result.Length - 1; i++)                                     // for each byte of the encoded value
                result[i] = (byte)(128 + ((value >> (i * 7)) & 127));                       // the msb(128) must be set but it is part of the value
            result[result.Length - 1] = (byte)((value >> ((result.Length - 1) * 7)) & 255); // the last byte contains 8 bit of the value
            return result;
        }