Skip to content

Instantly share code, notes, and snippets.

@sdmg15
Created Apr 10, 2022
Embed
What would you like to do?
// 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