Created
April 10, 2022 21:57
-
-
Save sdmg15/f06a5a261a11386d85d6e64803982520 to your computer and use it in GitHub Desktop.
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
// A helper function to determine the data model of the current platform | |
[[nodiscard]] constexpr const char* dataModelPlatform() { | |
if constexpr (sizeof(int) == 2 && sizeof(long int) == 8) { | |
if (sizeof(int*) == 2) { | |
return "ILP32"; | |
} | |
return "LLP64"; | |
} | |
if constexpr (sizeof(int) == 2 && sizeof(long long) == 8) { | |
return "LP32"; | |
} | |
if constexpr (sizeof(int) == 4 && sizeof(long) == 8) { | |
return "LP64"; | |
} | |
return "Unknown"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment