Created
July 23, 2011 06:05
-
-
Save hpcx82/1101090 to your computer and use it in GitHub Desktop.
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
bool IsLittleEndian() | |
{ | |
int code = 0x12345678; | |
char* pc = (char*)&code; | |
char a = (*pc); | |
char b = *(pc+1); | |
char c = *(pc+2); | |
char d = *(pc+3); | |
// 0x78 is the least significant byte, | |
// variable a is the value of lowest address byte | |
return a == 0x78; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment