Skip to content

Instantly share code, notes, and snippets.

@majioa
Created October 5, 2012 08:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save majioa/3838727 to your computer and use it in GitHub Desktop.
Save majioa/3838727 to your computer and use it in GitHub Desktop.
Some trick on c language
// 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