Created
February 20, 2020 16:35
-
-
Save embeddedmz/3d9ceee9576084cc5634f9a6126fda3c 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
const uint32_t test = 0xAABBCCDD; | |
const bool isBigEndian = (*reinterpret_cast<const uint8_t*>(&test) == 0xAA) ? true : false; | |
if (isBigEndian) | |
{ | |
std::cout << "CPU is big endian !" << std::endl; | |
} | |
else | |
{ | |
std::cout << "CPU is little endian !" << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment