Created
September 5, 2011 16:43
-
-
Save rschildmeijer/1195431 to your computer and use it in GitHub Desktop.
endianess
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define BIG_ENDIAN 0 | |
#define LITTLE_ENDIAN 1 | |
int testByteOrder() { | |
short int word = 0x0001; | |
char *byte = (char *) &word; | |
return (byte[0] ? LITTLE_ENDIAN : BIG_ENDIAN); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment