I have the following function in C# where I try to extract different fields of my protocol header from a stream of bytes. I am getting a red-carpet under
m_SequnceNumber = inBytes[5] & (byte)0x7f;
It says cannot implictly convert in to byte.
My sequence number is only 7 bits. Eighth bit is used as a flag. What is wrong with the below code ?
public Header(byte[] inBytes)
{
m_syncBytes = BitConverter.ToUInt16(inBytes,0);
m_DestAddress = BitConverter.ToUInt16(inBytes, 2);
m_SourceAddress = BitConverter.ToUInt16(inBytes, 3);
m_Proto = inBytes[4];
m_SequnceNumber = inBytes[5] & (byte)0x7f;
m_Length = inBytes[7];
m_HdrCrc = inBytes[8];
}