diff options
author | rtk0c <[email protected]> | 2022-05-27 13:47:40 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-05-27 13:47:40 -0700 |
commit | 30e7501b006e55bdeec0db18709d3fd4c5db86b5 (patch) | |
tree | 871e0fc6332c99d73f0aebb145f88b089f80c115 /buildtools/codegen/CodegenLookupTable.h | |
parent | 8fc3192da5ae3ac24511ad32088d669c799b6ddb (diff) |
Changeset: 40 Add custom token typing mechanism
Diffstat (limited to 'buildtools/codegen/CodegenLookupTable.h')
-rw-r--r-- | buildtools/codegen/CodegenLookupTable.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/buildtools/codegen/CodegenLookupTable.h b/buildtools/codegen/CodegenLookupTable.h new file mode 100644 index 0000000..02c0c7a --- /dev/null +++ b/buildtools/codegen/CodegenLookupTable.h @@ -0,0 +1,19 @@ +#pragma once + +#define LUT_DECL_VAR(name, aType, aCount, bType, bCount) \ + int name##A2B[aCount]; \ + int name##B2A[bCount]; \ + using name##AType = aType; \ + using name##BType = bType; \ + void InitializeLookupTable_##name() + +#define LUT_MAP_FOR(name) \ + int* lutMappingA2B = name##A2B; \ + int* lutMappingB2A = name##B2A +#define LUT_MAP(from, to) \ + lutMappingA2B[from] = to; \ + lutMappingB2A[to] = from + +#define LUT_INIT(name) InitializeLookupTable_##name() +#define LUT_LOOKUP(name, from) (name##BType)(name##A2B[from]) +#define LUT_REV_LOOKUP(name, to) (name##AType)(name##B2A[to]) |