Created
February 14, 2018 19:39
-
-
Save mtwilliams/625676444152bfc499b52fd228285ed1 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
#include <cstdint> | |
#include <cstdio> | |
#define LABEL(Label) \ | |
(((uint64_t)(#Label"\0" )[0] << 0)\ | |
|((uint64_t)(#Label"\0\0" )[1] << 8)\ | |
|((uint64_t)(#Label"\0\0\0" )[2] << 16)\ | |
|((uint64_t)(#Label"\0\0\0\0" )[3] << 24)\ | |
|((uint64_t)(#Label"\0\0\0\0\0" )[4] << 32)\ | |
|((uint64_t)(#Label"\0\0\0\0\0\0" )[5] << 40)\ | |
|((uint64_t)(#Label"\0\0\0\0\0\0\0" )[6] << 48)\ | |
|((uint64_t)(#Label"\0\0\0\0\0\0\0\0")[7] << 56)) | |
enum Tag : uint64_t { | |
COLOR = LABEL(COLOR), | |
BIPED = LABEL(BIPED), | |
TEXTURE = LABEL(TEXTURE), | |
ENGINEER = LABEL(ENGINEER) | |
}; | |
void pp(const Tag tag) { | |
printf("%#.016llx - \"%.8s\"\n", tag, &tag, &tag); | |
} | |
int main(int argc, const char *argv[]) { | |
pp(Tag::COLOR), pp(Tag::BIPED), pp(Tag::TEXTURE), pp(Tag::ENGINEER); | |
return 0; | |
} |
Author
mtwilliams
commented
Feb 14, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment