Microsoft.Protocols.TestSuites.SharedAdapter.LittleEndianBitConverter.ConvertFromBytes C# (CSharp) Method

ConvertFromBytes() private static method

Returns a value built from the specified number of bytes from the given buffer, starting at index.
private static ConvertFromBytes ( byte buffer, int startIndex, int bytesToConvert ) : ulong
buffer byte Specify the data in byte array format
startIndex int Specify the first index to use
bytesToConvert int Specify the number of bytes to use
return ulong
        private static ulong ConvertFromBytes(byte[] buffer, int startIndex, int bytesToConvert)
        {
            ulong ret = 0;
            int bitCount = 0;
            for (int i = 0; i < bytesToConvert; i++)
            {
                ret |= (ulong)buffer[startIndex + i] << bitCount;

                bitCount += 8;
            }

            return ret;
        }