diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-10-08 13:35:18 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-10-08 13:35:18 -0400 |
| commit | 954ed42934ad76ac101b27b6ff06be383ad5dcd2 (patch) | |
| tree | f0757e0e9bb87845d961be52a49c8f894e23e14c /types.c | |
| parent | 6b9055db7c03c09654c0605b96a37d50bf563fa9 (diff) | |
Simplify enum/struct codegen by using reusable general-purpose
metamethods for structs/enums instead of metamethod codegen for each struct/enum
defined.
Diffstat (limited to 'types.c')
| -rw-r--r-- | types.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -431,7 +431,7 @@ PUREFUNC size_t type_size(type_t *t) type_t *nonnull = Match(t, OptionalType)->type; switch (nonnull->tag) { case IntType: - switch (Match(t, IntType)->bits) { + switch (Match(nonnull, IntType)->bits) { case TYPE_IBITS64: return sizeof(OptionalInt64_t); case TYPE_IBITS32: return sizeof(OptionalInt32_t); case TYPE_IBITS16: return sizeof(OptionalInt16_t); @@ -511,7 +511,7 @@ PUREFUNC size_t type_align(type_t *t) type_t *nonnull = Match(t, OptionalType)->type; switch (nonnull->tag) { case IntType: - switch (Match(t, IntType)->bits) { + switch (Match(nonnull, IntType)->bits) { case TYPE_IBITS64: return __alignof__(OptionalInt64_t); case TYPE_IBITS32: return __alignof__(OptionalInt32_t); case TYPE_IBITS16: return __alignof__(OptionalInt16_t); |
