diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-11 12:01:17 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-11 12:01:17 -0400 |
| commit | dee3742b48e27ef36637d004163286d3352b0763 (patch) | |
| tree | 881a9a25b4cfeb6ff632a3fa48ccd3abd7f642ae /types.c | |
| parent | bba9f1b141fba5ffc366ef9377fb3089c0c5a1a3 (diff) | |
Optional structs
Diffstat (limited to 'types.c')
| -rw-r--r-- | types.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1,9 +1,10 @@ // Logic for handling type_t types #include <gc/cord.h> -#include <stdint.h> -#include <signal.h> #include <limits.h> #include <math.h> +#include <signal.h> +#include <stdint.h> +#include <sys/param.h> #include "builtins/integers.h" #include "builtins/table.h" @@ -418,6 +419,7 @@ PUREFUNC size_t type_size(type_t *t) case TYPE_IBITS8: return sizeof(OptionalInt8_t); default: errx(1, "Invalid integer bit size"); } + case StructType: return padded_type_size(nonnull) + 1; default: return type_size(nonnull); } } @@ -495,6 +497,7 @@ PUREFUNC size_t type_align(type_t *t) case TYPE_IBITS8: return __alignof__(OptionalInt8_t); default: errx(1, "Invalid integer bit size"); } + case StructType: return MAX(1, type_align(nonnull)); default: return type_align(nonnull); } } |
