cerealed icon indicating copy to clipboard operation
cerealed copied to clipboard

Add endianness support

Open togrue opened this issue 7 years ago • 5 comments

Cerealed seems to have no support for different byte orders. The library should clearly support both little and big endian.

togrue avatar Aug 15 '16 19:08 togrue

Cerealed was written primarily to implement networking protocols, which are invariably big endian. Other than faster serialisation between little endian machines, what's the use case?

atilaneves avatar Aug 29 '16 12:08 atilaneves

My particular testcase was, to read binary blocks (Type-Length-Data) out of a file and then decode the contained data into structs.

togrue avatar Aug 31 '16 21:08 togrue

Maybe I'm biased because of my background, but I would've stored the file data in big-endian in the first place. Unless you don't control the file format?

atilaneves avatar Sep 01 '16 07:09 atilaneves

I used the amazing lib to implement a passive DIAMETER protocol application. Two words:"Great job!"

Example use case is IoT (Internet of Things) protocols. What I'm seeing there is a shift to little-endian (or even worst, some kind of unknown mixture : https://github.com/google/eddystone/issues/138 ). I was frustrated too because I have "traditional" network background too.

P.S. "The library ~~should clearly support~~ is not bad to support both little and big endian." :+1:

atrips avatar Sep 04 '17 20:09 atrips

I've been working on little endian but it's not trivial.

atilaneves avatar Sep 12 '17 05:09 atilaneves