Created
October 5, 2012 08:21
-
-
Save majioa/3838727 to your computer and use it in GitHub Desktop.
Some trick on c language
This file contains 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
// Detection of an endianness in the run system. | |
int is_big_endian(void) | |
{ | |
union { | |
uint32_t i; | |
char c[4]; | |
} bint = {0x01020304}; | |
return bint.c[0] == 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment