atilaneves / cerealed

Powerful binary serialisation library for D
BSD 3-Clause "New" or "Revised" License
92 stars 3 forks source link

Feature request: Explicit endianness #9

Closed CounterPillow closed 8 years ago

CounterPillow commented 8 years ago

Some protocols/file formats may use a different endianness than the one native to the platform it is (de)serialised on.

Should a Big-Endian architecture ever gain D support, an application serialising data on it and then deserialising it on a Little-Endian platform will fail to do so.

File formats, such as PNG, use Big Endian ("network byte ordering"), yet the dominant Endianness today is Little Endian. Having a shortcut for saying "Please bswap if I need it" would be handy, instead of having to define this as custom behaviour.

atilaneves commented 8 years ago

Cerealed was written primarily for networking so it's always big endian because that's network byte order. Since I don't know of any usage that requires little-endian, it should work everywhere.