Bit order matters when a field uses part of a byte, or spans bytes starting or ending (or both) part way through a byte.
Example: 2 bytes of data first 235 (decimal) second 173 (decimal), aka hex EB and AD.
I want a bit field beginning at the fourth bit, through the 12th bit. So, skip over 3 bits, make a 9 bit unsigned integer from the next 9 bits.
I claim there are 4 possible outcomes:
byteOrder, bitOrder * bigEndian, bigEndian results in hex 0BA or decimal 186 * littleEndian, littleEndian results in hex 1BD or decimal 445 * littleEndian, bigEndian results in hex 05D or decimal 93 * bigEndian, littleEndian results in hex 1DE or decimal 478
I have seen the first 3 of these 4 in data. big, big, and little, little are easy to work out.
Hint for dealing with this.
If the byte order is big endian, write down bytes from left increasing to right. If the byte order is little endian, write down bytes from right increasing to left.