diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-08-03 15:06:59 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-08-03 15:06:59 -0400 |
| commit | 16c2e3f590d5136e90a4d195a877502faa544715 (patch) | |
| tree | cc07e362b4f64e85e510b1fd281d038371a6feba /types.c | |
| parent | 52544344f10f0383d54795099c6b3a4f627c579a (diff) | |
Incrementally moving towards passing array entry sizes explicitly
Diffstat (limited to 'types.c')
| -rw-r--r-- | types.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -486,6 +486,15 @@ size_t type_align(type_t *t) errx(1, "This should not be reachable"); } +size_t padded_type_size(type_t *t) +{ + size_t size = type_size(t); + size_t align = type_align(t); + if (align > 1 && size % align > 0) + size += align - (size % align); // Padding + return size; +} + type_t *get_field_type(type_t *t, const char *field_name) { t = value_type(t); |
