Skip to content

Conversation

@octanico
Copy link

No description provided.

@sebres
Copy link

sebres commented Apr 23, 2021

Endianness?

One could surely do that, but have to check __BYTE_ORDER (__BIG_ENDIAN__, __LITTLE_ENDIAN__, etc) or use htonll and co.
Just... good luck to implement it cross platform and compiler - for instance some compilers may lack __BYTE_ORDER and friends as well as probably unable to optimize constructs like this at compile time:

int n = 1; if(*(char *)&n) { /* Little Endian */ } else { /* Big Endian */ } 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants