SQLite Forum

Endianness help
Login
As others have alluded, I don't know of any processor/system that stores the _bits in a byte_ in a different order. I've never heard of there being a "_bit order issue_" when moving a file from one computer to any other. (But I cannot say there has _never_ been a machine on which this would be a problem). If the SO answers _are_ suggesting this, they're either mistaken (IMHO) or someone is being excessively pedantic without making clear it's an extreme possibility only.

If you write (and read) a sequence of bytes then endianess isn't an issue. They will be written and read in the order they are stored in memory (and in such an array, both types of machine would store the `0x01` in a lower memory address than `0x02`).

Endianness comes into play when you deal with "larger than byte" things: e.g. multi-byte integers. If you had a 16-bit (2-byte) integer with value `0x0102` then a big-endian machine would store it in memory and write it as the two bytes `0x01` and `0x02`, whereas a little-endian machine would store it and write `0x02` and `0x01`.

As for SQLite, it ensures that what's written to disk is always big-endian format so that if you move a database file from one system to another with a different format, it will not matter. _One_ of those machines would be able to read the data "natively"; the _other_ would need to swap bytes around as it read and wrote them. But both would handle the database identically.