SQLite Forum

Endianness help
Login
Bit-level endianness is more of an implementation technicality since you don't generally have bit-level addressing instructions on CPU or storage controllers available*.

Something like 0b1000000 might actually be stored as 0b0000001 in memory (PowerPC and Sparq comes to mind - I don't know if any modern big-endian CPU's still does it), but as a byte it's still 0x80, and if you do >> 7 you still get 0x01. And when it stores it to disk, it will store it as a byte, and the disk will return it as a byte - no matter on what platform that disk is connected to.

In serial wire protocols like UART or 802.3 it does specify that you have to use LSB first, but unless you are literally developing the hardware that sits in between a consistent big endian CPU and UART on a bus that's something other than PCI, you'll never have to deal with it.

NOTE: C bitfields which allow you to address into the middle of a byte. e.g.
struct s
{
   signed y:1;
   signed x:1;
}; is a compiler abstraction that translates these into bitwise operations. And it's very much not serializable to portable disk or wire - not because of endianness so much, but because different compiler implementations have different storage representations of it.