SQLite Forum

Endianness help
This isn't technically an sqlite question but I'm hoping some of the august minds on this forum might help me in any case. Stackoverflow just hit me with smug soundbites. They tell me endianness doesn't come into it at bit/byte level yet this article (https://www.linuxjournal.com/article/6788) states

"Bit order usually follows the same endianness as the byte order for a given computer system. That is, in a big endian system the most significant bit is stored at the lowest bit address; in a little endian system, the least significant bit is stored at the lowest bit address."

If I save a char to a file on a memory stick and it contains the bit pattern 00000001 would it not be loaded as '@' on a little endian system and 0x01 on a big endian system? I'm thinking I would have to choose an endianness to save the char in (which would mean reversing the bit pattern if the host endianness didn't match my chosen endianness) and then I'd know whether to do the same when loaded onto a different host.

I notice in the sqlite3.c code that Richard saves 16 and 32 bit ints as big endian and converts them back if loaded onto a little endian system but I don't see any reversing of bits within a byte. Is the aforementioned article wrong or am I missing something?