in reply to Test and endianness
Another possibility is to adjust the order of the bytes read based on the ordering of the bytes of the magic number in the header. Basically the same idea as the BOM in UTF-16 docs.