I know that endianness refers to the ordering of bytes, but I read that little endian and big endian machines might also order bits within bytes in opposite order as bit order usually follows the same endianness as the byte order in a system (is this wrong)? From my understanding of bytes, the order of bits with an individual byte matters (that is why there is a least- and most-significant bit), so are bytes represented differently in memory in little and big endian machines? Wouldn't this affect how bytes are written to files, and even affect encodings such as UTF-8 where byte-endianness does not matter (since single characters can be a byte and consequentially byte order is significant and must be maintained)? I am assuming that text encoded in UTF-8 is portable between little and big endian machines, so that leads me to the conclusion that there must be a standard for how individual bytes are represented on disk (am I also wrong in drawing this conclusion?).
Asked
Active
Viewed 44 times
1
-
Lots of useful links to follow at http://stackoverflow.com/questions/16803397/can-endianness-refer-to-bits-order-in-a-byte?rq=1 (could not find one that addresses on-disk layout, though). – Thilo Jun 24 '16 at 00:38
-
1@Thilo I found a link at http://stackoverflow.com/questions/5493515/how-bit-endianness-affects-bitwise-shifts-and-file-io-in-c?rq=1 that I believe may answer the question. I think the hardware interface of the actual storage device determines how bytes are stored (how bits are ordered), and therefore the order of bits is predetermined in stored bytes based on the storage device, but how they are loaded into memory or into the processor depends on the endianness of the machine. Therefore, I believe when it comes to stored files, we can treats bytes as a sort of indivisible unit of memory. – Preetpal Jun 24 '16 at 02:13