I have an array of bytes that I read from a header section of a message. These bytes contain the length of the message. There never are more than 3 bytes and they are ordere
Something like this should work:
data[0] + 256*data[1] + 256*256*data[2]
Your compiler should optimize that to the 'right' bit twiddling operations.